johnel johnel

Niner since 2012


  • For . . . Next Iterations - 08

    @halit ates:The "Exit For" statement jumps the code out of the "For Next" statement. Say that you need to evaluate whether a condition is true for thousands of values (For index = 1 to 1000000)  . If the value you are looking for is the first one that is evaluated and is true then without the "Exit For" statement your code would check the next 999999 values even though you have already found the value that you are looking for.  So basically the "Exit For" simply speeds up the execution of your software by "jumping over" all of the values that you do not need to evaluate. In older versions of basic you would have used a "GoTo" statement to do the same thing at the expense of adding one more line of code.