Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extra Commas
#1
Just a little comma confusion on my part.

https://qb64phoenix.com/qb64wiki/index.php/MAPTRIANGLE

This is from example 3 - about the half-way point in the program:

Code: (Select All)
_MapTriangle (0, 0)-(255, 255)-(255, 0), TextureImage& To(xx3%, yy3%)-(xx1%, yy1%)-(xx4%, yy4%), , _Smooth

I'm not sure what the commas do at the end of the line. 


The same thing can be found in this example:

Code: (Select All)
Circle (400, 450), 10, _RGB32(100, 100, 100), , , .5


The only wording I've seen so far is on the circle wiki page which seems to suggest this is about "aspect".   I believe this changes the circle to an ellipse.   But no real mention of using 3 commas in a row as a plan of attack.   I'm starting to expect to see more inexplicable multiple commas as I read more program examples.
 
If anyone can explain this a bit more, please do.   Cheers!
Reply
#2
The commas are place keepers for unused parameters.

The circle example: start and stop radian parameters go where the blank commas are
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Reply
#3
G'day,

Some statements have 1 tail-end parameter that is optional, so the parameter and comma before the parameter can be excluded when not needed/applicable.

When there are multiple optional parameters at the tail-end, and only the last one is not needed, same thing.  Just exclude the last parameter and related comma.

The same "process" continues iteratively until all optional parameters are excluded when not needed/applicable.

But things get a little messy when "middling" optional parameters are not needed, but tail-end optional parameters are needed.

To not confuse a compiler/interpreter, the positions of those "middling" optional parameters are identified by the commas and the space between the commas.  That way it can tell that the last parameter is for this/or/that, because it can figure out the position of it by counting those commas.

Something like that.
Reply
#4
(11-19-2022, 10:14 PM)OldMoses Wrote: The commas are place keepers for unused parameters.

The circle example: start and stop radian parameters go where the blank commas are

Dammit, I wish I could have written it that way.  Nope, I've got to write a long digest every time...
Reply
#5
Thanks for the replies and explanations - makes sense.
Reply
#6
Another example:
If you wanted a line of a certain style parameter, but you're ok with a white default color and don't want it to box or box fill. The color and box fill parameters must be "acknowledged" if not used so that the LINE command doesn't confuse a style parameter with a color parameter.

Code: (Select All)
SCREEN _NEWIMAGE(400, 400, 32)

LINE (50, 50)-(200, 50), , , &HF0FFF0FF
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Reply
#7
I haven't seen this one before either  Big Grin  Thank you
Reply
#8
I'd like to help, but like I told Mark, I'm all out of commas. You know guys, if you'd just be more like me, and stick to SCREEN 0, you wouldn't keep finding yourselves in these pickles!

Pete Big Grin
Reply




Users browsing this thread: 1 Guest(s)