Monday, November 30, 2015

Perl6: get and prompt

   #
   # get and prompt
   #

   my $name;

   say "Hi, what's your name?";
   $name=get;

   my $weekday = prompt( "Well $name, what day is today? " );

   given $weekday {
      when 'Monday' { say 'My condolences.' }
      default { say "$weekday, eh?" }
   }


$ perl6 input.pl6
Hi, what's your name?
Rob
Well Rob, what day is today? Monday
My condolences.

1 comment: