|
-
January 28th, 2010, 11:35 AM
#3
Re: C# good alternatives to C++/goto statement
 Originally Posted by nelo
Hi Alex To,
Your English is very good. I didn't see any image link. YOu may need to edit your post and sort that out. I think this is an opportunity to re-write the code in the C# style (Many would say that the over-use of the 'goto' is not good C++ either). You're not copying the code think of it as re-writing it but with the benefit of something to compare against or aim at. I would even say just forget about the 'goto' and any possible equivalents in C#. You should not need to duplicate code to avoid using the 'goto'. I've said all this without looking at any of the C++ code though...But I'm convinced you can re-write it in C# without the 'goto'.
the link to the image is at the top of the post, before he even starts his post.
As for alternatives, most use "while" or "do/while" loops. To exit a for loop, you can use the "break" keyword.
===============================
My Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|