programming-examples/perl/Statement/if-elsif statement.pl

25 lines
429 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#if ( expression ){
# statements;
#elsif ( expression ){
# statements;
#}
#elsif (expression){
# statements;
#else{
# statements;
#}
$day_of_week = int(rand(7)) + 1;
print "Today is: $day_of_week\n";
if ( $day_of_week >=1 && $day_of_week <=4 ) {
print "from 9 am to 9 pm\n";
}
elsif ( $day_of_week == 5) {
print "from 9 am to 6 pm\n";
}
else {
print "weekends\n";
}