Convert A For Loop To A While Loop | C Programming Tutorial

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

just a detail, but I think the scope of the variable i is not the same.

KnottyDoctor
Автор

A really great way to teach about both kinds of loops!

karimshariff
Автор

When I was first thaught 'C', some 4 decades ago, my tutor advised me to use 'for' only when the exact number of iterations is known the moment the loop starts. In all other cases use 'while'. The use of 'do while' is highly discouraged, not because of it not being right, but because it produces a quite more complex executable. Often for no reason.

tjdewolff
Автор

Sometimes we get confused, especially when we have an infinite loop, but with this very good transposition of every single property of each loop, we will never be lost again.!
I think the while loop is more interesting than the for loop... it is closer to our way of thinking and solving a problem but the trap is when we fall into the infinite loop and the stack overflow!!!
is there gonna be examples of the differents cases using a while loop? Thanks

zoquevil
Автор

Great video, and explanation. But I have to ask, why would you want to change it from a for loop, to a while loop?

juanmacias
Автор

Is there an advantage of one over the other? Or is one an alternative to the other?

Mnogojazyk
Автор

I love to have funs with for loops i made without condition and then inside it i made if to break loop there is no programer to never do this

harge