Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is it possible that?
#7
(02-14-2024, 06:52 PM)gaslouk Wrote:
(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.
There's nothing mysterious going on here. Instead of hard coding numeric values like so:

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).
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
Is it possible that? - by gaslouk - 02-14-2024, 02:17 PM
RE: It is possible that? - by bplus - 02-14-2024, 02:36 PM
RE: It is possible that? - by gaslouk - 02-14-2024, 02:39 PM
RE: Is it possible that? - by bplus - 02-14-2024, 04:13 PM
RE: Is it possible that? - by SpriggsySpriggs - 02-14-2024, 04:16 PM
RE: Is it possible that? - by gaslouk - 02-14-2024, 06:52 PM
RE: Is it possible that? - by TerryRitchie - 02-14-2024, 09:59 PM
RE: Is it possible that? - by Pete - 02-15-2024, 05:39 AM
RE: Is it possible that? - by Kernelpanic - 02-16-2024, 09:37 PM
RE: Is it possible that? - by vince - 02-16-2024, 04:57 PM
RE: Is it possible that? - by bplus - 02-17-2024, 02:35 AM
RE: Is it possible that? - by Abazek - 02-17-2024, 11:21 AM
RE: Is it possible that? - by bplus - 02-17-2024, 02:48 PM
RE: Is it possible that? - by dbox - 02-17-2024, 04:08 PM
RE: Is it possible that? - by CharlieJV - 02-17-2024, 04:30 PM
RE: Is it possible that? - by bplus - 02-17-2024, 05:12 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)