4. Computer Choice Part 2.. question?


So when put in the code the way it asks it gives me a sytax error due to a curly bracket

But when I take out some apparently unnessesary curly brackets... Wow it works!!!

I just want to know why?


If you use the IF ELSE statement construct

if (condition)
 exactly-1-statement allowed
 exactly-1-statement allowed

If you want to execute more than 1 statement
you will have to encapsulate these statement's in a pair of curly-brackets-{ }
therewith creating a so-called code-block

Thus you would get

if ( condition ) {
  //IF code-block
else {
  //ELSE code-block

== the Book ==
== code-convention ==


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.