I think that
Is much prettier when written aswhen 'f' { say "You ran away from the $enemy.name()!" } if ($.weapons.exists($_)) { .attack($enemy, $.weapons{$_}); } else { say "Please enter a valid command!" }
"when" combined with "if"/"else" just doesn't feel right. It's better style to write %.weapons, by the way. (Why would $.weapons even work? It's not declared!)when 'f' { say "You ran away from the { $enemy.name }!" } when $.weapons { .attack($enemy, $.weapons{$_}); } default { say "Please enter a valid command!" }
Note that my comments are not tested against the reality of Pugs.
Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
In reply to Re: P6: OO Wizard Game (RPG kinda, sorta)
by Juerd
in thread P6: OO Wizard Game (RPG kinda, sorta)
by eric256
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |