this post was submitted on 04 May 2024
8 points (100.0% liked)
Programmer Humor
32497 readers
495 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Wow. I totally forgot that Commodore BASIC ignores spaces in variable names. I do remember that it ignores anything after the first two letters though. That said, there's a bit more going on here than meets the eye.
PRINT HELLO WORLD
is actually parsed asPRINT
HELLOW
OR
LD
, that is: grab the values of the variablesHELLOW
(which is actually justHE
) andLD
, bitwiseOR
them together and then print.Since it's very likely both
HE
andLD
were undefined, they were quietly created then initialised to 0 before their bitwise-OR was calculated for the0
that appeared.Back in the day, people generally didn't put many spaces in their Commodore BASIC programs because those spaces each took up a byte of valuable memory. That PET2001, if unexpanded, only has 8KB in it.
</old man rant>
dijkstra was right