Which keyword is not used for looping?

Enhance your programming skills with the RECF Programming Test. Features flashcards and multiple choice questions with hints and explanations. Prepare for success!

Multiple Choice

Which keyword is not used for looping?

Explanation:
Looping means making a block of code run repeatedly. The keywords that control looping are for, while, and do. For usually uses a counter and runs until a limit is reached; while checks the condition before each iteration and repeats as long as it stays true; do (in a do-while pattern) executes the block at least once and then continues looping while the condition remains true. The keyword not used for looping is the one used for a single-time conditional branch: if. It evaluates a condition and executes its block only if true, without repeating. So this keyword is not used for looping.

Looping means making a block of code run repeatedly. The keywords that control looping are for, while, and do. For usually uses a counter and runs until a limit is reached; while checks the condition before each iteration and repeats as long as it stays true; do (in a do-while pattern) executes the block at least once and then continues looping while the condition remains true. The keyword not used for looping is the one used for a single-time conditional branch: if. It evaluates a condition and executes its block only if true, without repeating. So this keyword is not used for looping.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy