Course of Raku / Essentials / Control flow essentials / Conditional checks / Using elsif

Quiz: if, elsif, and else

Complete the following program. Here is a password check procedure. Fill in the missing parts. (Consider it an exercise only.)

.my $password = prompt 'Enter your password: ';
if␣␣␣␣␣ $password eq '12345' {
.    say 'Really?';
.}
elsif␣␣␣␣␣ $password.chars < 3 {
.    say 'Too short';
.}
elsif␣␣␣␣␣ $password eq '*&(#&$#Y' {
.    say 'Correct password';
.}
else␣␣␣␣␣ {
.    say 'Password is wrong';
.}

Course navigation

Using elsif   |   Using unless

Translations of this page: EnglishDeutschEspañolItalianoLatviešuNederlandsБългарскиРусскийУкраїнська