top of page

06 Control Structures

if (conditional)

Control Structure Comparison


the if statement which is often used in conjunction with a comparison operator, tests whether a certain condition has been reached, such as an input being above a certain number. The format for an if test is:

if(expression){

  // statement(s)

}


expression:      a (boolean) C statement that evaluates to true or false

if, which is used in conjunction with a comparison operator, tests whether a certain condition has been reached, such as an input being above a certain number. The format for an if test is:

The curly braces may be omitted after an if statement. If this is done, the next line (defined by the semicolon) becomes the only conditional statement.



© 2021 Odyssey Navigator. All rights reserved.

bottom of page