QBasic syntax error?

Dec 21, 2012 41 Replies

Comments are the problem. I went through a bunch of trouble to set up a VM with a 32-bit Virtual XP and then copy all my QBASIC stuff over from an older machine to try it out after posting my response.

It was pretty easy to test. I didn't use just your code. I used some I wrote, too, just to be absolutely sure.

No comments on DATA statements in QBASIC. The documentation even mentions it: "A remark can be inserted on a line after an executable statement if it is preceded by the single-quote form of REM or if REM is preceded by a colon." Note the use of "executable statement" in the above description. DATA is not an executable statement.

Besides. I tried a lot of different ways to check this out. You can't do it. Check it out yourself. It will actually read up the comment, if you try using a string variable instead of a numeric one. It is NOT a comment on a DATA statement. It is part of the data, like it or not.

Jon

Robbie the Robot was from "Forbidden Planet", which was a classic sci-fi version of Shakespeare's "The Tempest". Robbie appeared in numerous other movie and TV productions over the years. (Regarding "The Tempest" / "Forbidden Planet", Michael Crichton also "borrowed" the same basic "creatures from the id" theme for "Sphere".)

Best regards,

Bob Masta DAQARTA v7.10 Data AcQuisition And Real-Time Analysis

formatting link
Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE Signal Generator, DaqMusic generator Science with your sound card!

Larkin, more than likely.

One of my guys wrote a C program (GCC, linux) that involved some signal averaging. One subroutine added 4 million 16-bit ADC samples to a 32-bit array. It seemed awfully slow to me, so I did it on my PC in PowerBasic, just a FOR loop with the obvious subscripts, no pointers or anything, 8 lines of code or some such. It took a minute or two to code and compile. Mine was 4x faster than his. After a day of futzing with compiler optimizations and stuff, he got his runtime down to 1.2x of mine.

What's cool about an ugly, hazardous, 40 year old programming language? What's good about syntax errors?

John Larkin Highland Technology Inc www.highlandtechnology.com jlarkin at highlandtechnology dot com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom timing and laser controllers Photonics and fiberoptic TTL data links VME analog, thermocouple, LVDT, synchro, tachometer Multichannel arbitrary waveform generators

---------------------------------------------------------------------------­­-------------

-

Was the $50 thing the DOS version? It's OK, but the 32-bit Console Compiler rocks. It does Ethernet / TCP/IP beautifully. Good Windows graphics.

John Larkin Highland Technology Inc www.highlandtechnology.com jlarkin at highlandtechnology dot com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom timing and laser controllers Photonics and fiberoptic TTL data links VME analog, thermocouple, LVDT, synchro, tachometer Multichannel arbitrary waveform generators

---------------------------------------------------------------------------­-------------

Okay, I checked, the one in Lost In Space was "Robby", not "Robbie". Being Canadian, obviously my ear for American accents missed the distinction. ;)

I have no big issue with BASIC--old FORTRAN code has the same problem.

But Merry Christmas to you and your family as well.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 USA +1 845 480 2058 hobbs at electrooptical dot net http://electrooptical.net

---------------------------------------------------------------------------­-------------

If you think that's gorgeous, you need to get out more.

;)

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 USA +1 845 480 2058 hobbs at electrooptical dot net http://electrooptical.net

Cool, I'll give it a try.

George H.

th

Oops, my fault I was thinking of Robbie

formatting link

George H.

------­­-------------

tax

hen

iables

n with

Wow.. OK, apparently I screwed up too. All I can say is that Asimov's Robbie (sans Robot) dates to 1939.

I never knew there were so many...

Oh it's just the 'hammer' I'm comfortable with.

Thanks, we had a great time at granma's, another family with twin boys always joins us. They're six now, nothing like a pair of six year old boys to spice up the evening! I parked myself in a corner with a beer and enjoyed the show.

George H.

t -

Wow.. OK, apparently I screwed up too. All I can say is that Asimov's Robbie (sans Robot) dates to 1939.

with

e_(short_story)

double oops, I missed a )

formatting link

array.

than

there's no shortage of bad programmers.

So you think an older programming language is better?

?? 100% natural --- news://freenews.netfront.net/ - complaints: news@netfront.net ---

If you want, you can just start up the DOS box, then type:

MODE CON: LINES=50

Then start up QB45.

Jon

t

Ok Jon, I added a colon at the end of the DATA statement followed by the comment, and the problem went away. Still strange why Borland Turbo Basic behaves differently. Jasen also had the right answer.

-Bill

Why is it strange? They were written by different people.

Why strange? There is no standard BASIC, or I guess it's really "there's so many to choose from".

array.

than

He wrote the obvious c code, a loop with pointers and an add.

What's

PowerBasic isn't old.

Modern Basics have all sorts of goodies. Like TRY/CATCH, PRINT USING, jillions of cool intrinsic string functions, all sorts of data types, great graphics built in. Basic has evolved a lot, and c has hardly evolved at all.

The best programming language around is probably Ada, but few people are willing to invest the modest amount of discipline that it requires. Most people prefer to type fast and debug until they have to ship.

John Larkin Highland Technology Inc www.highlandtechnology.com jlarkin at highlandtechnology dot com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom timing and laser controllers Photonics and fiberoptic TTL data links VME analog, thermocouple, LVDT, synchro, tachometer Multichannel arbitrary waveform generators

array.

or

than

his

What's

willing

Why stop then? Certainly bugs don't care that the product was shipped. IME, they rather like a new set of hands to uncover them.

Hmm... Dr Phil wants to play, eh?

array.

FOR

or

than

his

What's

willing

Sure, let the users find the bugs for you. Microsoft does that. Next rev, fix a few of the worst ones and add a bunch more. Step and repeat.

formatting link

I love those examples on page 2.

John Larkin Highland Technology Inc www.highlandtechnology.com jlarkin at highlandtechnology dot com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom timing and laser controllers Photonics and fiberoptic TTL data links VME analog, thermocouple, LVDT, synchro, tachometer Multichannel arbitrary waveform generators

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required