From a16d53070c5ee3846a8e8b27640e7322c6d77e8a Mon Sep 17 00:00:00 2001 From: drudge Date: Tue, 21 Nov 2023 07:44:50 -0800 Subject: [PATCH] ch4 progress --- ch4/ex4-1.raku | 5 +++++ ch4/ex4-2.raku | 7 +++++++ ch4/ex4-3.raku | 9 +++++++++ 3 files changed, 21 insertions(+) create mode 100644 ch4/ex4-1.raku create mode 100644 ch4/ex4-2.raku create mode 100644 ch4/ex4-3.raku 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; + } +}