Share/Bookmark

If Control Structure

Today I'm putting together a chart for the "if" control structure. The chart is intended for developers who program in php, vbscript, and javascript. Its easy to get the syntax wrong when you program with all three scripting languages.

"If"

php if (condition) {
     statements;
}
javascript if (condition) {
     statements
}
vbscript if (condition) then statement 1 : statement 2

or

if (condition) then
     statements
end if

"Else"

php if (condition) {
     statements;
} else {
     statements;
}
javascript if (condition) {
     statements
} else {
     statements
}
vbscript if (condition) then
     statements
else
     statements
end if

"ElseIf"

php if (condition) {
     statements;
} elseif (condition 2) {
     statements;
} else {
     statements;
}
javascript elseif not available
vbscript if (condition) then
     statements
elseif (condition 2) then
     statements
else
     statements
end if

References

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

iZachy Newsletter

Don't have time to visit iZachy everyday? Then sign up for my free newsletter. I'll send you an email when I have something to share with you. Your email address will be kept confidential and I will not share, sell, or rent it to anyone. You can unsubscribe at any time by clicking a link in the email.

Enter your email address to sign up for my newsletter:
  

Or you can also sign up for our blog feed.