0
How to convert for statement into switch
What are there differences
1 ответ
+ 7
You can't
So for keyword used to create loops. To peform some operation MULTIPLE times
Swith `switches` between different code blocks by gven value
So switch have some `cases` that can be ran in different situations
Example:
switch (peoples) {
  case 0:
    System.out.println("Noone is here =(");
    break;
  case 1:
    System.out.println("You are alone :S");
    break;
  case 2:
    System.out.println("Hello, my friend! :~)");
    break;
  default:
    System.out.println("It's a party time! ^^");
    break;
}





