Ask Question
21 February, 01:41

True or False?

The break statement causes a loop to stop the current iteration and begin

the next one.

+3
Answers (1)
  1. 21 February, 02:53
    0
    False.

    The different between break and continue instruction is that with break you exit the loop, and with continue you skip to the next iteration.

    So, for example, a loop like

    for (i = 1; i < = 10; i++) {

    if (i < = 5) {

    print (i);

    } else {

    break;

    }

    }

    will print 1,2,3,4,5, because when i=6 you will enter the else branch and you will exit the loop because of the break instruction.

    On the other hand, a loop like

    for (i = 1; i < = 10; i++) {

    if (i % 2 = = 0) {

    print (i);

    } else {

    continue;

    }

    }

    Will print 2,4,6,8,10, because if i is even you print it, and if i is odd you will simply skip to the next iteration.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “True or False? The break statement causes a loop to stop the current iteration and begin the next one. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers