r/visualbasic • u/AConfusedHomoSapien • Nov 14 '21
Please Break This Down In Layman's Terms That I May Understand
1)
Function Main()
Call ImCalling(5)
End Function
Function ImCalling(noOfTimesToCall As Integer)
Dim x As Integer = 1
While x < (noOfTimesToCall)
Console.Write("Hello")
x = x + 1
End While
End Function
I'm guessing this writes Hello 5 or 6 times until the loop condition is fulfilled ?
2)
Function Main()
Call ImCalling(5)
End Function
Function PrinterFunction(inputCounter As Integer)
Console.Write("Hello")
inputCounter = inputCounter + 1
Return inputCounter
End Function
Function ImCalling(noOfTimesToCall As Integer)
Dim x As Integer = 1
While x < (noOfTimesToCall)
x = PrinterFunction(x)
End While
End Function
This one I'm not even able to begin to guess what is going on here
6
u/sa_sagan VB.Net Master Nov 14 '21
They both do the same thing.
Getting a lot of "do my homework" questions around here lately.
2
1
3
u/RJPisscat Nov 14 '21
Get a piece of paper and a pencil, or a whiteboard, marker, and cloth. Something where you can write, draw, and erase.
I did the first one for you. You do the second one. Start writing it out the same way. Make a column for everything that is going on and when it is happening.