if statements test a control statement to see whether it is true or false.
else and elsif clauses can also be tagged on the back.
Unless statements offer you the opposite functionality. If the control statement evaluates to false then the statements inside the block are executed.#your basic if if($value==1){ print "value is equal to 1\n"; } #your basic if/else if($value==1){ print "value is equal to 1\n"; } else{ print "value is not equal to 1\n"; } #your basic if/elsif/else if($value==1){ print "value is equal to 1\n"; } elsif($value==2){ print "value is equal to 2\n"; } elsif($value==3){ print "value is equal to 3\n"; } else{ print "value is not equal to 1,2, or 3\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: if statements
by Mr. Muskrat (Canon) on Jun 16, 2002 at 14:36 UTC | |
by PapaLoach (Novice) on May 09, 2003 at 04:03 UTC | |
by Mr. Muskrat (Canon) on May 09, 2003 at 13:40 UTC | |
by PapaLoach (Novice) on Jun 09, 2003 at 19:56 UTC |
Back to
Tutorials