Chapter 4 Loops Flashcards
1
Q
Each time a loop is executed is called an ___.
A
iteration
2
Q
While loop syntax
A
syntax:
//initialization
while (//condition>) {
//statements
//update
}
ex:
int j=0;
while (j <= 5){
System.out.println(j);
j++;
}
3
Q
Return a random int between 0 & 9
A
(int)(Math.random() * 10)
4
Q
Sentinel value definition
A
a specific input value to signify the end of the loop.
5
Q
What type of value do you avoid using in loops for equality checking
A
Floating point values