diff --git a/ch4/ex4-1.raku b/ch4/ex4-1.raku new file mode 100644 index 0000000..883cae9 --- /dev/null +++ b/ch4/ex4-1.raku @@ -0,0 +1,5 @@ +sub MAIN ( + $word #= string to count the characters of +) { + say $word.chars; +} diff --git a/ch4/ex4-2.raku b/ch4/ex4-2.raku new file mode 100644 index 0000000..2960051 --- /dev/null +++ b/ch4/ex4-2.raku @@ -0,0 +1,7 @@ +sub MAIN () { + my $bjort = "a"; + while $bjort { + $bjort = prompt "Provide a string to count the chars"; + say $bjort.chars; + } +} diff --git a/ch4/ex4-3.raku b/ch4/ex4-3.raku new file mode 100644 index 0000000..f280470 --- /dev/null +++ b/ch4/ex4-3.raku @@ -0,0 +1,9 @@ +sub MAIN () { + loop { + my $answer = prompt "Provide string to check for presence of Hamad\n"; + $answer.contains("Hamad") ?? + say "Hamad detected" !! + say "No Hamad detected"; + last if $answer.chars == 0; + } +}