Advertisement
MrDoyle

6) If Statements

Jan 14th, 2021
813
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. public class Main {
  2.  
  3.     public static void main (String [] args){
  4.  
  5.         int myInt = 6;
  6.  
  7.         if (myInt < 10){
  8.             System.out.println("Low");
  9.         } else if (myInt < 20) {
  10.             System.out.println("Medium");
  11.  
  12.         } else {
  13.             System.out.println("High");
  14.         }
  15.  
  16.  
  17.         int loop = 0;
  18.  
  19.         while (loop < 5){
  20.             System.out.println("Looping: " + loop);
  21.             loop++;
  22.         }
  23.  
  24.         System.out.println();
  25.         int loop2 = 0;
  26.  
  27.         while (true) {
  28.             System.out.println("Looping2: " + loop2);
  29.  
  30.             if (loop2 == 5) {
  31.                 break;
  32.             }
  33.  
  34.             loop2++;
  35.             System.out.println("Running");
  36.         }
  37.     }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement