Answer:
Option b false
Step-by-step explanation:
In programming, a break statement will terminate the loop and the program control will return to the statement after the loop. This means the loop won't prepare for the next iteration when a break statement is encountered.
One common use case of break statement is when we wish to terminate a linear search once the target number is found from an array. For example:
- let target = 10;
- let myArray = [1, 10, 5, 6, 8, 9, 11];
- let found = false;
- for(let i = 0; i < myArray.length; i++){
- if(target === myArray[ i ] )
- {
- found = true;
- break;
- }
- }
Since there is no point to continue the loop after the target number is found and therefore a break statement (Line 9) is included to terminate the loop.