December 2012

S M T W T F S
      1
2345678
9101112131415
16 171819202122
23242526272829
3031     

Style Credit

Expand Cut Tags

No cut tags
Saturday, December 27th, 2003 08:09 am
Wrote this in the past 10 mins.

As far as I can recall, it would actually work for a spccy.

However, that was long long ago in a galaxy far far away.

So...

corrections?


Spot the bugs in the code... please:

10 Let X = 10
20 For X = 10 to 3 goto 30; else goto 120
30 print x" green bottles, standing on the wall"
40 print x" green bottles, standing on the wall"
50 print "and if one green bottle should accidently fall"
60 print "There'll be "(x-1)" green bottles, standing on the wall"
70 let x=x-1
80 goto 20
120 For X = 2 goto 130; else goto 220
130 print x" green bottles, standing on the wall"
140 print x" green bottles, standing on the wall"
150 print "and if one green bottle should accidently fall"
160 print "There'll be "(x-1)" green bottle, standing on the wall"
170 let x = x-1
180 goto 120
220 For x = 1 goto 230; else goto 300
230 print x" green bottle, standing on the wall"
240 print x" green bottle, standing on the wall"
250 print "and if one green bottle should accidently fall"
260 print "There'll be no green bottles, standing on the wall"
261 print " "
262 print "Thankyeaueiuowaiouuwverwymuch"
263 print " "
270 let x = x-1
280 goto 220

300 end


((Specifically, I can't remember if "let x =" needs some quotation marks... but mainly as I'm talking in a language I haven't spoken for nearly 20 years would like to know if anyone else can deny or confirm...))

(((also is "end" a correct and necessary command or superfluous?))))

Thanks for helping, and equally thanks for pretending you never saw this (I have a rep after all...)
Saturday, December 27th, 2003 02:03 am (UTC)
Hmmmmmm, not sure off the top of my head (I was a commodore kinda person myself), but this might help.
Saturday, December 27th, 2003 04:05 am (UTC)
I, of course have no idea whatsoever, you'd not catch me doing that kind of thing ever...
lots of love
Patrick
XXXX
Saturday, December 27th, 2003 04:25 am (UTC)
should that be IF....ELSE rather than FOR....ELSE?

Also not a speccy person though.
Saturday, December 27th, 2003 06:02 am (UTC)
Below is a generic BASIC version of above. I'm not sure if the differences are due to Sinclair BASIC (as I never used it) or cloudy memories. Below will work on BBC Basic and the Microsoft BASIC on the TRS-80. Incidentally when Microsoft brought out QuickBasic they used & instead of + for string concaternation. END is valid but optional.

20 FOR X = 10 TO 3 STEP -1
30 PRINT X;" green bottles, standing on the wall"
40 PRINT X;" green bottles, standing on the wall"
50 PRINT "and if one green bottle should accidently fall"
60 PRINT "There'll be ";(X-1);" green bottles, standing on the wall"
80 NEXT X
120 LET X = 2
130 PRINT X;" green bottles, standing on the wall"
140 PRINT X;" green bottles, standing on the wall"
150 PRINT "and if one green bottle should accidently fall"
160 PRINT "There'll be ";(X-1);" green bottle, standing on the wall"
180 X = X - 1
230 PRINT X;" green bottle, standing on the wall"
240 PRINT X;" green bottle, standing on the wall"
250 PRINT "and if one green bottle should accidently fall"
260 PRINT "There'll be no green bottles, standing on the wall"
261 PRINT " "
262 PRINT "Thankyeaueiuowaiouuwverwymuch"
263 PRINT " "
300 END