baabaa_nl
asked on
Learn all the loops in vb.net
Hi,
I would like to learn all the available loops in VB.net.
Please do provide me with a link or links that teaches all the loops from the basic to intermediate to the very advance.
Thanks in advance.
I would like to learn all the available loops in VB.net.
Please do provide me with a link or links that teaches all the loops from the basic to intermediate to the very advance.
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi CodeCruiser,
could you please list me all the names of the loops available in the vb.net language.
Thanks in advance
could you please list me all the names of the loops available in the vb.net language.
Thanks in advance
I have listed the names and a link to example in my comment above.
ASKER
I was expecting "do until loop" too, but I just now realized that it is part of java and not in vb.net.
Thank You
Thank You
For and For Each have been presented. But I would add my personal touch to the different While and Until loops.
Do Until ... Loop is there, as well as Do Loop ... Until but I do not recommend using those. Neither would I recommend using the Do Loop ... While.
Do While ... Loop and While ... End While do the same thing, and I would suggest that you stick to one of those.
You can do anything in a While loop, just by setting the proper condition.
As an example, While x>=10 is the same as Do Until x<10.
Some programmers use both While and Until, as well as the Do ... Loop While/Until (you are sure to pass at least once in the loop since the condition is at the end) and Do While/Until ... Loop (might not go in at all if the condition is true on the first pass). I do a lot of code review and have found out that programmers that mix the different conditional loops often do mistakes because they are in one kind of loop but code the condition for another one.
Programmer who always use While ... End While do not tend to do that type of mistake because they always use the same logic to prepare their loops. They have one way of looping instead of four. And I repeat, you can do the equivalent of all the 4 types of loops with While ... End While just by using the proper condition.
Another type of loop is recursion, a method that calls itself. Some would not consider that a loop because there is no keyword associated with it, but since it is a way to repeat the same operation many times, I personally see that as a loop.
One can also create some kind of loop by using a Timer.
Do Until ... Loop is there, as well as Do Loop ... Until but I do not recommend using those. Neither would I recommend using the Do Loop ... While.
Do While ... Loop and While ... End While do the same thing, and I would suggest that you stick to one of those.
You can do anything in a While loop, just by setting the proper condition.
As an example, While x>=10 is the same as Do Until x<10.
Some programmers use both While and Until, as well as the Do ... Loop While/Until (you are sure to pass at least once in the loop since the condition is at the end) and Do While/Until ... Loop (might not go in at all if the condition is true on the first pass). I do a lot of code review and have found out that programmers that mix the different conditional loops often do mistakes because they are in one kind of loop but code the condition for another one.
Programmer who always use While ... End While do not tend to do that type of mistake because they always use the same logic to prepare their loops. They have one way of looping instead of four. And I repeat, you can do the equivalent of all the 4 types of loops with While ... End While just by using the proper condition.
Another type of loop is recursion, a method that calls itself. Some would not consider that a loop because there is no keyword associated with it, but since it is a way to repeat the same operation many times, I personally see that as a loop.
One can also create some kind of loop by using a Timer.
A quick search in Google (or similar search engine) will give you an abundance of suggestions etc. One such search is https://www.google.co.uk/#q=vb.net%20loops%20tutorial which should give you a lot of things to work on.
Another option, is to search through ExpertsExchange for previous questions and/or posts from Experts.
I hope you find what you need!
Jonathon