Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

1.12.2 while loops in karel quiz question: 1 why do we use while loops …

Question

1.12.2 while loops in karel quiz question: 1 why do we use while loops in javascript? to break out of some block of code to do something if a condition is true to repeat some code while a condition is true to repeat something for a fixed number of times

Explanation:

Brief Explanations

In JavaScript, a while loop is a control - flow statement that repeats a block of code as long as a specified condition evaluates to true. It's not for breaking out of code (that's break statement), not just for doing something once when a condition is true (that's if statement), and not for a fixed number of repetitions (that's for loop in many cases).

Answer:

C. To repeat some code while a condition is true