TEST 3 topics and review Flashcards
Comparator > meaning?
Greater than
Comparator < meaning?
Less than
Comparator == meaning?
Equal to
Comparator != meaning?
Not equal to
Comparator >= meaning?
Equal to or greater than
Comparator <= meaning?
Equal to or less than
What is a while loop?
Loops that repeat the code an indefinite amount of times
What is a condition?
Conditions control while loops, which will repeat itself if the condition is true. Conditions can be numeric comparisons, string comparisons, and are established by using comparing operators (comparators.)
String comparator .equals() meaning?
Equal (case sensitive)
String comparator !.equals() meaning?
Not equal (case sensitive)
How to show equal to if the string variable is “Hello”
var.equals (“hello”);
How to show NOT equal to if the string variable is “Hello”
!var.equals (“hello”);
Keyword to writing a while loop:
while
What do you do to control the while loop so that it doesn’t become infinite?
Something in the body of the loop should modify the condition variable so the condition will eventually become false.
What is the while loop checking process?
Checks condition at the start of the loop, and if it’s true it will carry out loop until it reaches the bottom. Then, it will go back to the top again and continue until it becomes false.
Minimum times a loop can run?
0
Difference between a do.while loop and a while loop?
A do while loop is checked at the bottom, but the while loop is checked at the top.
Minimum lines a do.while loop can run?
1
When using a multiple condition, each comparison needs to be checked complete and connected to??
Boolean operator.
What’s the syntax and explanation of operator AND?
Syntax: &&
Explanation: All conditions need to be true for it to be true.
What’s the syntax and explanation of operator OR?
Syntax: ||
Explanation: At least one condition must be true for it to be true.
How are if statements and conditional statements different?
Conditional statements are repetition, but if statements are branching.
How many conditions do if statements need to be true?
At least 1
Summarize else if statements
Else if statements can be written after an if statement to check additional conditions in the case the first one is false. As many else if statements can be added, but only the first one which is true will be executed.