02-14-2024, 09:59 PM
(02-14-2024, 06:52 PM)gaslouk Wrote:There's nothing mysterious going on here. Instead of hard coding numeric values like so:(02-14-2024, 04:16 PM)SpriggsySpriggs Wrote: Gaslouk, they're just obscuring the data passed to COLOR to make it look like they're doing something neat. See what QB64 gives you if you do "PRINT 6 * 2 + 3, 0 - 5 + 8 * 2 - 11 "Ηι
In how many basic can you do this? I didn't see it in anyone's program, I just stumbled upon this little MSXbasic program trying to run it on QB64. After modification of course. And the same thing happens the "screen". SCREEN 16-4"
That's why I asked.
COLOR 15, 0
Or using variables:
Fcolor = 15
Bcolor = 0
COLOR Fcolor, Bcolor
The code you came across forced BASIC to do a little math first:
COLOR 6 * 2 + 3, 0 - 5 + 8 * 2 - 11
Six times two = 12 plus three = 15
Eight times two = 16 plus zero = 16 minus five = 11 minus eleven = 0
So there's your two numbers 15, 0
You can place math statements like this in all versions of BASIC, although using this style of coding without including a variable or two is strange. My guess is the programmer that wrote this code wanted to make the code look more exotic or make him/herself look like some sort of guru programmer (but failed miserably).

