485,927 views
39 votes
39 votes
SOMEONE PLS HELP?!?!!

SOMEONE PLS HELP?!?!!-example-1
User Samarpan
by
3.0k points

1 Answer

14 votes
14 votes

Answer:

B. To continuously check the state of a condition.

Step-by-step explanation:

The purpose of an infinite loop with an "if" statement is to constantly check if that condition is true or false. Once it meets the conditions of the "if" statement, the "if" statement will execute whatever code is inside of it.

Example:

//This pseudocode will print "i is even!" every time i is an even number

int i = 0;

while (1 != 0) //always evaluates to true, meaning it loops forever

i = i + 1; // i gets incrementally bigger with each loop

if ( i % 2 == 0) //if i is even....

say ("i is even!"); //print this statement

User Shakespeare
by
2.8k points