the if statement
The first type of branching statement we will look at is the if statement. An if statement has the form:
In an if statement, condition 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.
if (condition) { // code to execute if condition is true } else { // code to execute if condition is false }
In an if statement, condition 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