Cursus Raku / Essentiëlen / Voorwaardelijke controles / Gebruik van elsif
Quiz: if, elsif en else
Voltooi het volgende programma. Hier is een wachtwoordcontroleprocedure. Vul de ontbrekende delen in. (Beschouw het alleen als een oefening.)
| . | my $password = prompt ‘Voer je wachtwoord in: ‘; |
| if | ␣␣␣␣␣ $password eq ‘12345’ { |
| . | say ‘Echt?’; |
| . | } |
| elsif | ␣␣␣␣␣ $password.chars < 3 { |
| . | say ‘Te kort’; |
| . | } |
| elsif | ␣␣␣␣␣ $password eq ‘*&(#&$#Y’ { |
| . | say ‘Correct wachtwoord’; |
| . | } |
| else | ␣␣␣␣␣ { |
| . | say ‘Wachtwoord is fout’; |
| . | } |
Cursusnavigatie
←
Voorwaardelijke controles / else blokken
|
Voorwaardelijke controles / Gebruik van unless
→
💪 Or jump directly to the exercises to this section.
Deze pagina is automatisch vertaald met ChatGPT 4o. Originele Engelse tekst.
Vertalingen van deze pagina: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська