Cloudbook:
C
Home
Control
If/Else
§ 3
↵ lesson
← prev
next →
C-O-matic
If statement
Else statement
Foreach statment
If/Else
# Here is an example if/else statement. # From this example, using nesting of two # if/else statements (an if/else inside either # the if or the else block of an if/else # statement, either way can work) to check # the value of a temperature stored in # $t and say "Ouch!", or "Brrrr!" or "Mmmm ..." # depending of $t being to high, too low, or # neither too high nor too low. $t = 100 ; if ( $t>212 ) { print "It's boiling!" ; } else { print "I should check whether it's freezing." ; }
The output goes here