QB64 Phoenix Edition
Extra Commas - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Extra Commas (/showthread.php?tid=1155)



Extra Commas - james2464 - 11-19-2022

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!


RE: Extra Commas - OldMoses - 11-19-2022

The commas are place keepers for unused parameters.

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


RE: Extra Commas - CharlieJV - 11-19-2022

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.


RE: Extra Commas - CharlieJV - 11-19-2022

(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...


RE: Extra Commas - james2464 - 11-19-2022

Thanks for the replies and explanations - makes sense.


RE: Extra Commas - OldMoses - 11-19-2022

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



RE: Extra Commas - james2464 - 11-19-2022

I haven't seen this one before either  Big Grin  Thank you


RE: Extra Commas - Pete - 11-20-2022

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