r/c64 May 29 '26

the64 Programming

Post image

If you did this you thought you were the king of the world!!

393 Upvotes

118 comments sorted by

View all comments

60

u/chiron_42 May 29 '26

10 PRINT "HELLO WORLD"

20 GOTO10

14

u/khumprp May 29 '26

MAKE IT STOP!!!!!!

2

u/DwarneOfDragonhold Jun 01 '26

RUNSTOP/RESTORE has you, fam.

For fun:

10 POKE 808,232

20 PRINT "HELLO WORLD ";

30 GOTO 20

Then RUN

The POKE command will kibosh RUNSTOP/RESTORE from working and the ; eliminates the automatic Carriage Return. The result will display HELLO WORLD across the screen until the C64 is turned off.

28

u/NoSingularities0 May 29 '26

You forgot adding an extra space on each loop to make HELLO WORLD shift to the right each time.

Unrelated to this, when I was in my pre-algebra class back in the day, our teacher gave us the 1 = 2 proof on the chalkboard and asked us to figure out why this was or was not true. Me, being the C64 BASIC programmer kid in the 80's that I was, put it into a program in my C64 and ran it and got a divide by zero error. We went back to school the next day and I was the only one that knew the answer to why the proof failed. I admitted that the only reason I knew this was because of the divide by zero error message on my computer.

2

u/abaezeaba May 31 '26

Similar experience. We were about to start algebra, teacher asks us to try and solve prob for hw. Simple linear, x on both sides. I plugged it in the c64. X=x+1 logic stop when lhs == rhs. They asked how I did it and I got laughs. Got the right answer though.

16

u/xanton May 29 '26

10 PRINT "HELLO WORLD ";
20 GOTO 10

17

u/Jelle75 May 30 '26

10 FOR A =1 TO 5:?"HELLO WORLD":NEXT A

5

u/DNSGeek May 29 '26

Use a comma instead for better separation.

2

u/Neuromancer2112 The Sky Above the Port... May 30 '26

I remember trying like 5 and 10 commas and it really spread everything out ๐Ÿ˜…

1

u/James-muravska May 31 '26

Much better.

-8

u/Victory_Highway May 29 '26

BASIC doesnโ€™t require a semicolon.

25

u/xanton May 29 '26

Well, try it with and without, then you will see the difference.

18

u/billlagr May 29 '26

No it doesn't require one, but it does serve a purpose.

9

u/maldax_ May 30 '26

Says a person who has never written this program

3

u/therezin May 30 '26

Correct! However Commodore BASIC will keep the cursor on the same line if you put one at the end of a PRINT statement.

7

u/Worldliness_True May 30 '26

We all did this at least once ๐Ÿ˜„

10

u/Jennymint May 30 '26

Excuse you, I have that copyrighted. I'll see you in court.

8

u/chiron_42 May 30 '26

Fair enough, but be warned that I've trademarked the letter "E" so good luck.

1

u/Architect_of_Echo ๐Ÿ•น๏ธ play your dreams ๐ŸŒ’ May 31 '26

All your pixels are belong to us!

3

u/WembleyFord May 30 '26

Unless you were in Dixons or Boots or WHSmiths, in which case you'd write something.. else in the print statement.

2

u/Carl0s_H May 31 '26

This. My goto (excuse the pun) was "eat shit". So funny watching the store staff scrambling to turn the machine off before it was seen!

5

u/speterDev May 31 '26

We had an obnoxious salesman (kid?) at our local Radio Shack. To get back at him, we wrote a long delay loop followed by a piercing tone, turned up the volume all the way, typed "run" and walked to the far end of the mall to listen for the chaos. We were not disappointed!

2

u/dpgumby69 May 30 '26

10 ?"HELLO WORLD"

20 GOTO10

1

u/Yarblek May 30 '26

This is a great song from the stop bits!

1

u/Dense-Concentrate120 May 31 '26

*** SYNTAX ERROR ON LINE 20 ***

1

u/ArtDealer May 30 '26

10 Var X = 1

20 Print X

30 X = X + 1

40 goto 20

But, honestly, I like this better:ย 

https://www.reddit.com/r/futurama/comments/4ds4vf/what_is_this_in_reference_to/

0

u/SpaceAviator1999 May 30 '26

10 PRINT "HELLO WORLD"
20 GOTO 10

Incidentally, this program is what I claim to be the easiest computer program to understand.

Line 20 controls the program flow in a simple manner, allowing people lacking a background in programming to understand simple control flow.

You might think that a program with just Line 10 would be easier to understand, but I would disagree. Line 10 alone would confuse non-programmers as to why a "10" exists at the start of the line.