Guest User

Untitled

a guest
Jul 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. //Traditional
  2. if ($cake == "fresh")
  3. {
  4. print "Yum yum! This cake is tasty.";
  5. }
  6. else
  7. {
  8. print "Yuck! This cake tastes awful!";
  9. }
  10.  
  11. //Ternary
  12. This can be rewritten as the following ternary statement:
  13. print ($cake == "fresh") ? "Yum yum! This cake is tasty." : "Yuck! This cake tastes awful!";
Add Comment
Please, Sign In to add comment