GoTo Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm just learning Visual Basic. I had a little experience with Basic a long
time ago. I see Visual Basic uses the GoTo Statement also.

My first practice program I wrote on my own, and was shown to a friend for
her to view and recommend any improvements. When she saw the GoTo lines she
almost had a calf!

Is this a big deal? The GoTo statement seems pretty upfront and simple.
She's recommending If / Else lines instead.

I'm just learning,
Amy
 
hi,
goto statements are used in vb but usually avoided because
it hard to track in vb. the code reads better when you
don't use goto statements
Regards
Frank
 
Amy,
There's nothing inherently wrong with a GoTo statement. It provides
unconditional branching capabilities within a procedure. It is especially
helpful for error trapping. If your procedure encounters an error, you may
not ever get to the conditional statements your friend recommended. An On
Error GoTo statement is the best way to handle that. However, if you have
too many of them you can make your code very difficult to read.
 
Back
Top