THE LACK THEREOF

Various musings of Brock Wilcox (@awwaiid)

Lesson 05 - IF THEN ELSE

$num = int(rand(10)) + 1;
  print "Try to guess my number! You get one try.\n";
  print "Your guess: ";
  $guess = <>;
  chomp $guess;
  if ($guess == $num) {
    print "You guess my number!!\n";
  } else {
    print "Sorry... you guessed $guess, but my number was $num.\n";
  }

  

Navigation

Blog

https://thelackthereof.org/pics/16px-Feed-icon.svg.png Blog RSS Feed

Tweets


2020-05-29

2020-05-27

Toots (Mastodon)

2018-07-02

2018-06-30

Code

Follow @awwaiid

Wiki Edits

https://thelackthereof.org/pics/16px-Feed-icon.svg.png Wiki RSS Feed

... more changes