Created
February 14, 2019 22:37
-
-
Save connorbrez/8e8cef62db35bebd8a8993e3f8ff2332 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // BOTH OF THESE STATEMENTS ARE EQUVILIANT | |
| for(int i = 0; i<10;i++){ | |
| // nothing would run, because there is no code | |
| }; | |
| for(int i = 0; i<10;i++); // ^ as said previous nothing runs because there is nothing to run | |
| // your example below | |
| { | |
| System.out.println("10") // prints once because not in loop, but it tricks you because its | |
| } // encapsulated with {}, usually this is done to help with readibility | |
| // BOTH OF THESE STATEMENTS ARE EQUVILIANT | |
| for(int i = 0; i<10;i++) System.out.println("10"); // this is okay because its on one line. | |
| // Java may not like this but in javascript/typescript its oka | |
| for(int i = 0; i<10;i++){ | |
| System.out.println("10") | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment