Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. # Format
  2.  
  3. ## Statement
  4.  
  5. ### IF STATEMENT
  6.  
  7. ```
  8. if(<condition>) <body>
  9. ```
  10. > ternary operator ? :
  11. ```java
  12. <condition> ? <true> : <false>
  13. example:
  14. boolean found = true;
  15. int n = found ? 10 : 20; //output 10
  16. ```
  17. ### FOR LOOP
  18.  
  19. ```
  20. for(<initialisation>,<guard or condition>, <increment or decrement expression>) <body>
  21. ```
  22. >syntactically correct loop: `for(;;);`
  23.  
  24. ### WHILE LOOP
  25. ```
  26. declaration and initiatialisation
  27. while(<condition>) {
  28. <body>
  29. <increment or decrement expression> }
  30. ```
  31. ```
  32. declaration and initiatialisation
  33. do { <body> }
  34. while(<condition>) ;
  35. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement