Ask Question
25 March, 15:15

True or False?

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

the next one.

+1
Answers (1)
  1. 25 March, 16:09
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers