ianbanks 30 Posted July 20, 2015 I've been digging a bit into the SQF grammar lately and came up with: A Complete Guide to SQF Operator Precedence Hopefully if I've explained it all well enough you should be able to figure out where parenthesis are needed in every situation, without the usual trial and error and long learning process. ;) Share this post Link to post Share on other sites
SilentSpike 84 Posted July 20, 2015 Saw this the other day, good job :) Share this post Link to post Share on other sites
killzone_kid 1332 Posted July 20, 2015 Pfft, showoff! ;) Share this post Link to post Share on other sites
MusTanG 21 Posted July 20, 2015 Thanks that was a good read Share this post Link to post Share on other sites
R3vo 2654 Posted July 20, 2015 Very good guide, I was always wondering where to put parenthesis and where not. BIS should put this guide in their next SITREP! Share this post Link to post Share on other sites
Kingsley1997 39 Posted July 20, 2015 I wish SQF had the += -= and ++ and -- operators :( Share this post Link to post Share on other sites
R3vo 2654 Posted July 21, 2015 I wish SQF had the += -= and ++ and -- operators :( What would those do ? Share this post Link to post Share on other sites
ianbanks 30 Posted July 21, 2015 (edited) What would those do ? They would be short for: _value = _value + _right and: _value = _value + 1 The += and -= version would be fairly easy to implement (they'd be a trivial change to the assignment part of the SQF grammar), but would still require changing the core language which BIS seems very reluctant to do (and for consistency you would want to introduce over a dozen other versions; *=, /=, &&=, etc). The ++ and -- operators would probably need a language and parser rewrite, since SQF does not have the concept of an "assignable" expression (an assignable expression such as lvalues in C/C++ , which is where most people know ++ and -- from). Assignment in SQF isn't an operator, it's a special part of the language grammar. So special that you can do this: 8ball = "black"; hint (currentNamespace getVariable "8ball"); // Hints "black" (When normally, "8ball" would be the number of "8" token followed by a variable or operator "ball"). Edited July 21, 2015 by IanBanks Share this post Link to post Share on other sites
Greenfist 1863 Posted July 21, 2015 What would those do ? https://en.wikipedia.org/wiki/Augmented_assignment Share this post Link to post Share on other sites
R3vo 2654 Posted July 21, 2015 https://en.wikipedia.org/wiki/Augmented_assignment I see, thanks for the link. Share this post Link to post Share on other sites
mrcurry 508 Posted July 21, 2015 Great read, this should be stickied. Share this post Link to post Share on other sites
dreadedentity 278 Posted July 21, 2015 (edited) I wish SQF had the += -= and ++ and -- operators :( This so much EDIT: It's such a pain to write: while {condition} do { //stuff counter = counter + 1; }; Edited July 21, 2015 by DreadedEntity Share this post Link to post Share on other sites