Pagina de inicio
/
Tecnología
/
What will happen if you omit the increment part of a for loop? The loop won't run The loop will still run but never stop The loop will stop after one iteration The loop will throw an error

Problemas

What will happen if you omit the increment part of a for loop?
The loop won't run
The loop will still run but never stop
The loop will stop after one iteration
The loop will throw an error

What will happen if you omit the increment part of a for loop? The loop won't run The loop will still run but never stop The loop will stop after one iteration The loop will throw an error

Solución

avatar
Domingoprofessionell · Tutor durante 6 años
expert verifiedVerificación de expertos
4.1 (269 votos)

Responder

The loop will still run but never stop.<br /><br />In a for loop, the increment part is responsible for updating the loop control variable. If the increment part is omitted, the loop control variable will not be updated, and the loop will run indefinitely, causing an infinite loop.
Haz clic para calificar: