+ 1

Which is best: goto or loops-while, for and do-while?

I was studing recursion when I saw about the "goto" command. I know that I may use it in recursion, but the loops-while and for do the same thing, no? Then, which and why I should use: goto or loops?

9th Sep 2018, 12:43 AM
Gabriel Felix dos Santos
Gabriel Felix dos Santos - avatar
4 Antworten
+ 4
i think goto statement make code buggy sometimes
9th Sep 2018, 1:43 AM
Fajar Maftuh Fadli
Fajar Maftuh Fadli - avatar
+ 3
goto usually just makes your code harder to read and slower, the only place where it's acceptable to use it is when you're breaking out of a nested loop. (but even there a control variable should do the trick)
9th Sep 2018, 9:28 AM
hinanawi
hinanawi - avatar
0
Thank you so much all
11th Sep 2018, 5:06 AM
Gabriel Felix dos Santos
Gabriel Felix dos Santos - avatar