Chapter 5

3 Pages
Unlock Document

Ryerson University
Information Technology Management
ITM 200
Vikraman Baskaran

Khushi Sharma Tuesday May 15 , 2012 Chapter 5 The ‘If-Else’ Statement Boolean Expressions: -Boolean expression is one which evaluates to a Boolean value -Examples: Expression Meaning X > Y is X greater than Y? X < Y is X less than Y? X >= Y is X greater than or equal to Y? X <= Y is X less than or equal to Y? X = Y is X equal to Y? X! = Y is X not equal to Y? The IF Statement -the IF statement decides whether a section of codes executes or not -the IF statement used a Boolean to decide whether the next statement of blocks of statements executes Boolean Value -there are only two possible values for Boolean expressions:  True  False Rational Operators -you can construct simple Boolean expressions from the relational operators which are below -Example: Rational Operators Meaning > Less than < Greater than <= less than or equal >= greater than or equal == Equals != not equals The IF-ELSE Statement – Details: -syntax of the java if-else statement is as below: If () else -if and else are Java reserved words, which give the if-else statement its structure and tell the complier that this is an if-else statement -the is a Boolean expression -the and are Java statements Khushi Sharma Tuesday May 15 , 2012 IF – ELSE Matching: -curly braces use is not required if there is only one statement to be conditionally executed -sometimes curly braces can help make the program more readable -indentation makes it much easier to match up else statements with their corresponding if statement Nested IF – ELSE Stat
More Less

Related notes for ITM 200

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.