The code below as you can see is a simple way to assign a value to $drink after $punter has been evaluated.
if($punter eq 'coffee'){ $drink = 'non alky'; } if($punter eq 'beer'){ $drink = 'alky'; } if($punter eq 'whisky'){ $drink = 'proper alky'; } else { $drink = 'unknown'; }
Now, surely there is a better way to do it, by that i mean with less lines of code, and if possible doing the same in a more efficient way.
I look forward to any answers, thanks,In reply to Simple IF, IF, IF or ELSE by abachus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |