Conditional Statement Syntax

If…Else
.if (condition){statements}
else if(condtion){statements}(0-infinity)
else(statements}{0-1}

Switch
.switch(variable)
{
case value: statements; break; (0-infinity)
default: statements; break; (0-1)
}

Loop Statements:
Loop statements are used to execute the code block several times.

While:
while(condtion){statements}
Do-while:
do {statements} while(condition)

For:
for(initialization; condition; increment){statements}

Foreach:
foreach(variable in array){statements}

There is two special statements there in loop statements:
break: end loop
continue: start next iteration (Send code execution to the beginning of the next iteration)

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s