Reputation: 76 Whiz
- Author w/DIC++
- Active Posts:
- 273 (0.22 per day)
- 17-December 11
- Profile Views:
- Last Active:
- Jun 22 2013 02:00 PM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Who Cares
- Dream Kudos:
Posts I've Made
Posted 21 Jun 2013As I've already mentioned there are some case where you can't. Eg Iterators.
Edit: Link to tutorial with example
I suppose. But that sounds like broken language design rather than a legitimate reason to include GoTo. I can understand why you'd use it in that case though.
Posted 21 Jun 2013
Quote... Can't you break to a label ...
So that would be a GoTo then?
No. GoTo can be misused horribly. This was what Dijkstra was complaining about when he wrote his paper on 'Goto considered harmful'. For example:
Label1: If Z GoTo Label2 Label2: If Y GoTo Label1 Label3: Goto Label2 Label4: If X GoTo Label3
This kind of nonsense should not be allowed. It quickly messes up control flow to the point where it becomes unreadable.
A break to label, is different because you are only allowed to break a *loop* to that particular label. So it is only used in the way you are using your GOTO.
Python actually doesn't have a break to a label statement at all, because the inventor considered it unnecessary as only a tiny percentage of code would actually need it.
Perhaps a better way to address these problems are to write your code using procedures, so that you don't have to nest loops in this way at all.
Posted 21 Jun 2013Eg while loop.
BeginingOfLoop: If condition = True Then GoTo FollowingCode loop code body GoTo BeginingOfLoop FollowingCode:
Seems horrible to me. Can't you break to a label? or just break in general? If you can't do those then I suppose you'll have to use GoTo. Maybe someone should just implement break instead, because that is what you are doing effectively, and get rid of this tiny edge case reason to use GoTo.
Posted 21 Jun 2013On the learning to program front, I thought the Logo introduced with One Laptop Per Child was brilliant. It ultimately became Scratch.
I think Logo is a good, easy to learn, first programming language.
Posted 21 Jun 2013
Quotelike GOTO which should just not be used
GoTo is method local in vb.net (and c#) and is sometimes useful.
It is my honest and sincere opinion that only crazy misguided beginners use GOTO. Can you explain how you think it should be used in modern programming?
- Member Title:
- D.I.C Regular
- Age Unknown
- Birthday Unknown
- Years Programming:
- Programming Languages:
- Java, Python, PHP, Bash