I'm not entirely sure what's going on in the loops, but break will simply terminate that for-loop and jump back to the first one. So this is a performance gain since isPrime is set to false the first time you get into that if-statement. You don't need to continue that for-loop. So you will gain all those checks against the if-statement that are left to do once isPrime is false.
I might be wrong though ^^
Show differencesHistory of post edits
#1PwFClockWise
Posted 19 December 2012 - 07:19 AM
I'm not entirely sure what's going on in the loops, but break will simply terminate that for-loop and jump back to the first one. So this is a performance gain since isPrime is set to false the first time you get into that for-loop. You don't need to continue that for-loop.
I might be wrong though ^^
I might be wrong though ^^