- Joined
- Mar 30, 2013
- Messages
- 456
- Reaction score
- 42
I will be explaning: DoWhile, While, If, Ternary Operators, and SwitchCase
DoWhile:
While:
If:
Ternary Operators:
Switch Case:
I WILL be adding more to this, such as some functions, classes, inheritance, and much more.
DoWhile:
The best way to explain this, is:
do { DO ALL OF THIS UNTIL IT IS NO LONGER HAPPENING} while(THIS IS HAPPENING)
Example:
int count = 1;
do{count++}while(count <= 9)
do { DO ALL OF THIS UNTIL IT IS NO LONGER HAPPENING} while(THIS IS HAPPENING)
Example:
int count = 1;
do{count++}while(count <= 9)
While:
while(THIS IS HAPPENING) { DO ALL OF THIS UNTIL IT IS NO LONGER HAPPENING }
Example;
int count = 1;
while(true)(infiniteloop) {
count ++;
}
Example;
int count = 1;
while(true)(infiniteloop) {
count ++;
}
If:
if ( IF THIS IS TRUE ) { THEN RUN THIS ONCE }
Example:
int count = 1;
if(true) {count ++;}
Example:
int count = 1;
if(true) {count ++;}
Ternary Operators:
WHILE THIS IS TRUE ? DO THIS ONCE else) DO THIS
Example:
int count = 1;
count == 1(if true) ? count++(do this) : count--;(else do this)
Example:
int count = 1;
count == 1(if true) ? count++(do this) : count--;(else do this)
Switch Case:
switch (what you want to be checking for)
case (One option of what you want to be true for the above info): break;
case (Second option of what you want to be true for the above info): break;
case (Third option of what you want to be true for the above info): break;
Examples:
Switch Case:
int count = 1;
switch (count)
case 1(is true, will run once): break; (used to stop the switch)
case 2(not true, will never be true): break; (used to stop the switch)
case (One option of what you want to be true for the above info): break;
case (Second option of what you want to be true for the above info): break;
case (Third option of what you want to be true for the above info): break;
Examples:
Switch Case:
int count = 1;
switch (count)
case 1(is true, will run once): break; (used to stop the switch)
case 2(not true, will never be true): break; (used to stop the switch)
I WILL be adding more to this, such as some functions, classes, inheritance, and much more.