473,387 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Goto: & Labels

What example can someone give to show how to use Goto Label: , but not to be
used for error control.
What if I want to use it to skip across a bunch of code?


Jul 17 '05 #1
2 30935
On Tue, 19 Aug 2003 05:57:00 GMT, "Option^Explicit"
<te********@shaw.ca> wrote:
What example can someone give to show how to use Goto Label: , but not to be
used for error control.
What if I want to use it to skip across a bunch of code?

For L9 = 1 To Max
If A$(L9) = "" Then GoTo SKIP
....

SKIP:
Next

However, be very careful using GoTo,
- its use is strongly deprecated by most programmers
- primarily because it used to be (ab)used
- creating tangled unreadable code

IMO - only use it if all practical alternatives produce *less*
readable code

You would be well advised setting yourself some strict rules for its
use

Jul 17 '05 #2
> What example can someone give to show how to use Goto Label: , but not to
be
used for error control.
What if I want to use it to skip across a bunch of code?


You should go out of your way to avoid using Goto, using it only when the
alternative is unreadable. So you understand, it is never "necessary" to use
Goto, there is always an alternative. To answer your direct question... if
you have code you wish to skip over, it is because some condition is not
being met. To state that another way, you want to execute you bunch of code
only if some condition is being met. You can do that with an If-Then-EndIf
block.

.......
.......
If SomeConditionIsMet Then
.....
.....
your bunch of code
.....
.....
End If
......
......

Rick - MVP
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Samee Zahur | last post by:
In a recent thread, I saw the topic of goto coming up, so here's a question: With a background of asm langs, I know exactly why goto is to be avoided. But does anyone know of a good way for...
51
by: WindAndWaves | last post by:
Can anyone tell me what is wrong with the goto command. I noticed it is one of those NEVER USE. I can understand that it may lead to confusing code, but I often use it like this: is this...
45
by: Debashish Chakravarty | last post by:
K&R pg.66 describes two situations when using goto makes sense. Has anyone here come across situations where using goto provided the most elegant solution. --...
7
by: Christopher Benson-Manica | last post by:
Can you goto switch labels? int i=0; /* arbitrary */ switch( i ) { case 0: if( !some_validity_check() ) { goto error; /* could be default as well */ } /* proceed normally */
17
by: Mike Hofer | last post by:
While I'd toyed with C, C++, and Java over the last 20 years or so, my principal language has been BASIC, QBASIC, then Visual Basic, and finally Visual Basic .NET. But lately, I've been using C#...
34
by: electrician | last post by:
Perl has it, Basic has it, Fortran has it. What is so difficult about creating a goto command for JavaScript. Just set up a label and say go to it.
3
by: electrician | last post by:
Yes, no GOTO. This is a major blunder on part of the creators of these tools. GOTO gives the programmer the absolute control over the program. Yes, no matter what, a GOTO sends the program to...
15
by: Frank | last post by:
Before I start, please let's not discuss whether goto is evil or not. For generated code, this can make perfect sense. It would be interesting to know a trick how to get C to do a goto to an...
59
by: raashid bhatt | last post by:
why are GOTO's not used they just a simple JMP instructions what's bad about them
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.