summary refs log blame commit diff stats
path: root/raku/bob/Bob.rakumod
blob: ab6fa66fbbdde8ed8005db705a7594fe3da33436 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                            
unit class Bob;

method hey (Str $msg is copy) {
    $msg .= trim;

    given $msg.trim {
        when .chars == 0 { "Fine. Be that way!" }
        when $_ eq .uc && $_ ~~ /<[a..zA..Z]>/ {
            return "Calm down, I know what I'm doing!" if $_.ends-with("?");
            "Whoa, chill out!";
        }
        when .ends-with("?") { "Sure." }
        default { "Whatever." }
    }
}