Saturday, December 11, 2010

Branching Statements

the if statement


The first type of branching statement we will look at is the if statement. An if statement has the form:
if (condition)
{
   // code to execute if condition is true
}
else 
{
   // code to execute if condition is false
}

In an if statementcondition is a value or an expression that is used to determine which code block is executed, and the curly braces act as "begin" and "end" markers. 

No comments:

Post a Comment