Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Codecademy;
- // tenary operator to replace if-else stm
- function ternaryCheckout($item){
- return $item <= 12 ? "express lane" : "regular lane";
- }
- function ternaryVote($age){
- return $age >=18 ? "yes" : "no";
- }
- echo ternaryCheckout(30);
- echo "\n";
- echo ternaryCheckout(1);
- echo "\n";
- echo ternaryVote(18);
- echo "\n";
- echo ternaryVote(5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement