Skip to main content
1 of 2
kzidane
  • 17.7k
  • 3
  • 28
  • 100

An if statement is NOT followed by a semicolon (i.e., ;). If you wanna check whether tower_height is greater than or equal to 0 AND less than or equal to 23. Then you probably need to write something like

if (tower_height >= 0 && tower_height <= 23)
{
    // do something
}

Notice that you must repeat tower_height as it's regarded as a separate condition.

The code in the body of this if statement is executed if and only if both conditions are evaluated to true.

If an if statement doesn't have opening and closing curly braces, then only a single statement (specifically the one right after the statement) is executed when the condition is evaluated to true.

kzidane
  • 17.7k
  • 3
  • 28
  • 100