Course of Raku / 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
←
Conditional checks / else blocks
|
Conditional checks / Using unless
→
💪 Or jump directly to the exercises to this section.
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська