Single Status Update
So after less than a year I'll get the hell out of school. I'll take a whole day to explain why I hated school most of the time so I'll just explain in short. First, I've been learning and studying stuff just to earn grades but not to actually use them for real. Second, I don't have any close friends to talk with, I'm not that lonely but the majority of them is not my type. Also, there are those immature people who care only about their muscles, getting attention and fights.
I've been told that there is a huge gap between the school and university, but I doubt that everything changes dramatically after putting your first step in the uni.
What do you think? Please share your experience about this.
- Show previous comments 22 more
What about using goto to break out of two or more loops? I always use it for that, it's convenient.
I specifically stated that there are exceptional situations in which it can be appropriate; however, for someone learning programming, "just avoid using goto" is good advice. The most important thing for a beginner is to learn how to write clear, structured code. "Careful, judicious use of goto" could be considered an advanced subject, and you can't judge when it is appropriate until you've learned how to write structured and readable code.
Personally I wouldn't even use goto for the scenario you're describing: I'd much rather factor out the loops to a function and use 'return', or simply refactor it to work some other way. Interestingly Java has a syntax that lets you label loops and break out of them by name, but the C and C++ standards haven't adopted that syntax.
First of all, good luck for CS. I'll be honest it is tedious at times but there's nothing like finishing a good chunk of code. Standing by what others have said, don't start by trying to jump into complex stuff. It's far more important to learn the mathematical logic behind programming. What you definitely shouldn't be worried about is syntax because you'll be able to get that done pretty fast in every new course. You'll probably be starting with Python anyway and it has one of the simplest syntaxes.
Echoing what fraggle said: Try to use proper indentations and especially avoid using too many goto statements. This is where I've got a peeve with languages such as C etc. People end up writing code that pretty much abuses the beauty of the language. Though this is probably bias due to a lot of recursive language work in my two years at uni so far.