Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created June 19, 2016 17:08
Show Gist options
  • Save zoffixznet/8b115b496cdddd6469b26b8159a16980 to your computer and use it in GitHub Desktop.
Save zoffixznet/8b115b496cdddd6469b26b8159a16980 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl6
sub menu {
say q:to/END/;
Simple Calc
1 to addition
2 to subtraction
3 to division
4 to multiplication
END
prompt '';
}
sub addition {
say "Addition";
}
sub subtraction {
say "Subtraction";
}
sub division {
say "Division";
}
sub multiplication {
say "Multiplication";
}
loop {
given menu() {
when -1 { last; }
when 1 { addition(); }
when 2 { subtraction(); }
when 3 { division(); }
when 4 { multiplication(); }
default { say "sub not available";}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment