Switch en perl
Fermé
pedro
-
24 juil. 2007 à 13:49
dubcek Messages postés 18755 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 14 novembre 2024 - 24 juil. 2007 à 14:00
dubcek Messages postés 18755 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 14 novembre 2024 - 24 juil. 2007 à 14:00
A voir également:
- Switch en perl
- Logiciel switch - Télécharger - Conversion & Extraction
- Samsung switch pc - Télécharger - Divers Bureautique
- Brancher switch sur pc ✓ - Forum Nintendo Switch
- Switch qwerty azerty - Guide
- Denon perl pro test - Accueil - Audio
1 réponse
dubcek
Messages postés
18755
Date d'inscription
lundi 15 janvier 2007
Statut
Contributeur
Dernière intervention
14 novembre 2024
5 621
24 juil. 2007 à 14:00
24 juil. 2007 à 14:00
là : https://www.perl.com/doc/FMTEYEWTK/style/slide37.html/
Perl Style: Learn to Switch with for
* Though Perl has no built-in switch statement, this is not a hardship but an opportunity.
* It's easy to build one. The word `for' is sometimes pronounced `switch'.
SWITCH: for ($where) {
/In Card Names/ && do { push @flags, '-e'; last; };
/Anywhere/ && do { push @flags, '-h'; last; };
/In Rulings/ && do { last; };
die "unknown value for form variable where: `$where'";
}
* Like a series of elsifs, a switch should always have a default case, even if the default case `can't happen'.
Forward to Switch by Using do{} Creatively
Back to Closures
Up to index
Perl Style: Learn to Switch with for
* Though Perl has no built-in switch statement, this is not a hardship but an opportunity.
* It's easy to build one. The word `for' is sometimes pronounced `switch'.
SWITCH: for ($where) {
/In Card Names/ && do { push @flags, '-e'; last; };
/Anywhere/ && do { push @flags, '-h'; last; };
/In Rulings/ && do { last; };
die "unknown value for form variable where: `$where'";
}
* Like a series of elsifs, a switch should always have a default case, even if the default case `can't happen'.
Forward to Switch by Using do{} Creatively
Back to Closures
Up to index