Advertisement
areyesram

Java Switch

Nov 13th, 2020
830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. switch (result.body.items[0]) {
  2.     case 1:
  3.         //do this
  4.         break;
  5.     case 2:
  6.         //do that
  7.         break;
  8.     case 4:
  9.         //whatever
  10.         break;
  11. }
  12.  
  13. if (result.body.items[0] == 1) {
  14.     //do this
  15. }
  16. else if (result.body.items[0] == 2) {
  17.     //do that
  18. }
  19. else if (result.body.items[0] == 4) {
  20.     //whatever
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement