Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any way to goto a label from inside a WITH DO block?

Status
Not open for further replies.

ProgressingPilgrims

Programmer
Apr 4, 2008
4
0
0
US
Is there a way I can get goto mylabel to work inside the below WITH DO block? After the begin I get the red squiggley line under both mylabel references as it is. If I change the colon to a semi-colon the red squiggley disappears from the second reference to mylable; All the code in this procedure is conveniently within this begin with NTO, coreVars DO section. Hope I can find a way to goto labels within it with much rearrangement.

procedure TTM_MtnSide.calc;
label
mylabel;
begin with NTO, coreVars do
begin
goto mylabel;
//bunch of code lines I want to skip
mylabel:
//more code lines
end
end;
 
I just felt that the "attack" on the OP was rather unfair when, in reality it is virtually impossible to program without GoTo. Additionally, if the language vendor provides GoTo, then it is not up to us to put down someone for using it. roo0047 was the only poster here to provide what I consider to be a helpful, constructive and intelligent answer

Just because the vendor provides it doesn't mean it's wise to use it. There are many other practices that fit along those lines. Go to is a great example, because it's almost universally considered to be bad practice. There isn't any attack, it's simply a provision of the best answer. It's not "putting down" anyone to provide the best answer - in this case it's "Don't use it.". Clear and simple and to the point. In fact, that's the universally accepted practice for both structured and object-oriented programming.

That's the helpful, constructive, and intelligent answer, not one that perpetuates bad practice. And why am I going to try to help someone perpetuate bad practice? I'll answer where I feel moved to, but if I happen to see bad practice (or a practice that could be better for some reason), I'm not going to let it get by, either. If there's a better way or a better answer, what's wrong with providing it? And if there's disagreement, that's what these forums are for - to discuss.

----------
Measurement is not management.
 
And if there's disagreement, that's what these forums are for - to discuss.

Glenn is correct, there are several 'pay per answer' web site out there if that's all people want.




Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
 
harebrain said:
Goto was never in Wirth's Pascal.
[blush]
Because nobody else called me on it, I'll correct my own mistake. Wirth's Pascal did include the "much-cursed" goto. He admitted, at the time, that omitting goto from the language was too revolutionary an idea.

He corrected that "mistake" subsequently in his Modula-2 language, which never achieved the popularity of Pascal.
 
I diddnt have any proof (still dont) and I still havn't had chance to check my old book, but am pretty sure it pre dates TP.

I just traweled through all the Pascal books on Amazon and found it.

A Crash Course in PASCAL by Donald M. Monro (Paperback - 1 Oct 1985)

But I don't know when TP was first released!



Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
 
Turbo Pascal version 1 was released in 1983, I started in 1986 with TP 3.x, accompanied by a book about TP 1.
GOTO was definitely in it.

He admitted, at the time, that omitting goto from the language was too revolutionary an idea.
Because all "scientific" flow charts written before (and after) 1980 (year of the IBM PC) had GOTO.

It would have been a major task for all the fortran, algol, pascal etc.. programmers to make the transition from mainframe to PC.

Did not know that it still existed in Delphi, but I must confess that I did not looked for it either.



Steven
 
My "Turbo Pascal Reference Manual" says copyrighted 1983.

In the Introduction it states: "Professor Wirth's definition of the Pascal language, published in 1971, was intended to aid the teaching of a systematic approach to computer programming, specifically introducing structured programming."

Roo
Delphi Rules!
 
Turbo Pascal itself was a single .COM file about 38 kilobytes long, and fitted with OS (MS-DOS) on a 180 kb floppy together with Wordstar and other files

How much space you need nowadays? How many USB sticks you need to keep up?

Steven
 
USB sticks? I carry a 250G 2-1/2" drive in an external USB enclosure.

Ctrl-K Ctrl-D

Roo
Delphi Rules!
 
My 16 GB USB stick, looks like a piece of candy (hard red), and about the same size (57 x 24 x 11 mm) (Dane Elec's Z-Mate, looks like the 2 GB model) can hold all the sources in all programming languages I ever produced in my 25 years of programming, and still has enough free space for some useable compilers as well...

HTH
TonHu
 
wow....wordstar, that's a blast from the past....my dad had a osborne that came with wordstar....he still has the PC with all the disks!! One of my first programs ever my sister and I wrote on that PC using Basic I think. I remember the numbered lines and we made balloons float up the monitor:
[tt]
XXXXX
X X
X X
X X
X X
X X
XXX
XXX
[/tt]
And look at me now....my daughters call me a nerd and that makes me happy!

Leslie
 
Leslie did you used goto ? [shadeshappy]

I remember when I got my first virus infection, it was the cascade virus and started kind a funny. I was typing in TP 4 and suddenly a letter at the top of the page fell down [ponder], I went up an typed it again, but another one fell down. After then minutes it was raining letters, until the code of two nights of working with minimum sleep was at the bottom of the monitor [flush]. In the subsequent days I learned about these [curse] computer virus...

Steven
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top