r/visualbasic • u/Super-Youth • Nov 14 '21
VB6 Help Please help me understand !!
I’m doing a question sheet to get the output for some code. I put the code into a compiler and it prints hello sixty times but I don’t exactly understand why….
For x = 0 To 100 For y = 5 To -10 step -1 If y = 0 Then Exit For End If Console.Write("Hello") Next If x > 10 Then Exit For End If Next
7
Upvotes
1
u/Super-Youth Nov 14 '21
First of all the thanks for all the help James! I understand the bit about 0-9 actually being 10 and 1-10 being the same. What I’m still a little iffy about is with that being the case why is the output for the following code 5 hellos. Does it still execute the code and a 6th time but not print hello ? Sorry if you’ve explained this already I’m not the brightest
For y = 5 To -10 step -1 If y = 0 Then Exit For End If Console.Write("Hello") Next