Cu ajutorul instructiunilor conditionale putem face un script care sa ia singur decizii pe baza anumitor conditii puse de noi. Aceste instructiuni sunt:
- Instructiunea if
Aceasta este cea mai folosita conditie. Structura este:
daca conditia nu este indeplinita se va sari peste aceasta etapa.HTML Code:You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
Exemplu:
HTML Code:You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!- Instructiunea if ... else
Aceasta instructiune ajuta la adaugarea unui cod ce va fi executat daca instructiunea if nu este indeplinita. Structura este:
Exemplu:HTML Code:You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
Acest cod va afisa:HTML Code:You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!Buna ziua- Instructiunea switch
Aceasta instructiune este folosita pentru a compara o valoare cu alta dintr-o lista.
Exemplu:
Acest cod va afisa:HTML Code:You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!Comanda break opreste citirea codului mai departe atunci cānd se ajunge la ea.Ma numesc Bogdan
Comanda default executa un cod in caz ca nu este indeplinita nicio executie case.
NEXT TUTORIAL: You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
TAGS