Correct usage of break.
#8

For the record, something which no one specified: you can use continue to "break" a loop on the current iteration and continue on the next one.

If in your prime example you used continue instead of break it would've done what you had intended; however, the loop will still run even after you find your value, so for efficency you use break once you find the value so it doesn't run anymore.
Reply


Messages In This Thread
Correct usage of break. - by Alvin007 - 08.02.2015, 23:35
Re: Correct usage of break. - by Schneider - 08.02.2015, 23:44
Re : Correct usage of break. - by Alvin007 - 08.02.2015, 23:46
Re: Correct usage of break. - by PowerPC603 - 08.02.2015, 23:48
Re : Correct usage of break. - by Alvin007 - 09.02.2015, 00:06
AW: Correct usage of break. - by Nero_3D - 09.02.2015, 01:41
Re : Correct usage of break. - by Alvin007 - 09.02.2015, 01:46
Respuesta: Correct usage of break. - by CuervO - 09.02.2015, 03:31
Re: Correct usage of break. - by Vince - 09.02.2015, 06:42
Re : Correct usage of break. - by Alvin007 - 09.02.2015, 11:48

Forum Jump:


Users browsing this thread: 2 Guest(s)