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

14 lines
223 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#if ( expression ){
# statements;
#else{
# statements;
#}
$coin = int (rand(2 )) + 1; # Generate a random number between 1 and 2
if( $coin == 1 ) {
print "HEAD\n";
}
else {
print "TAIL\n";
}