Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to determine when for-loop is done
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: How to determine when for-loop is done

This code:
Module VBModule
Dim intInteger as Integer = 0
    Sub Main()
        For intInteger = 0 To 4
            Console.Writeline("The current integer is: " & intInteger)
        Next
        Console.Writeline("This is outside the For-Next Loop")
    End Sub
  
End Module

Will produce this:
[Image: ca252a5fce.png]

So it will do the For-Next loop first, then after it has finished, will run the proceeding code.
While that is Vb.Net, since code is sequential, that is, every thing occurs in the order it is fed sequentially, a computer will follow instructions in the order it has been written. A For-Next Loop will repeat until the loop condition is met, then carry out the following code.

This is why when you make a While loop and cause an infinity loop, the game crashes. Because it cannot end it, uses up resources trying to and fails to execute any latter code before hanging.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 06-16-2015, 11:22 AM by Romulator.)
06-16-2015, 11:15 AM
Find


Messages In This Thread
RE: How to determine when for-loop is done - by Romulator - 06-16-2015, 11:15 AM



Users browsing this thread: 4 Guest(s)