Jump to content
Larry Ullman's Book Forums

Statement Vs Control Structures


Recommended Posts

Larry in the book at the beginning you state that "comments, php tags, control structures (conditionals, loops, and so on), and certain other constructs don't require semicolons."  How am I supposed to differentiate between them?  What does a statement look like compared to a control structure or construct?  Sorry for my ignorance but until I can see a difference the rule won't stay in my head.  And I don't like to move on until I get a grasp of the rule.  Hopefully I am making sense.

Link to comment
Share on other sites

The short/best answer is that you'll figure it out in time and that you shouldn't try to memorize all the possibilities right now. The longer answer is that statements are complete thoughts, such as:

$var = 23;

Whereas control structures are not:

while (condition) {
}

The control structure in and of itself is nothing, and does not terminate with a semicolon.

 

Again, though, you'll grasp this in time.

Link to comment
Share on other sites

 Share

×
×
  • Create New...