White space between operators is not meaningful. These are all functionally similar, people use each according to personal test:
$X=;
$X =;
$X = ;
$X = ;
This is an odd but important syntax aspect as the ‘=’ followed by ‘;’ indicates a reset. So, make the value of the left side that attribute’s or, for variables that data-type’s, default value. For $MyString or a String-type variable it is no value or more precisely an empty string "".
White space has meaning inside a quote string. Thus literal string " hello" starts with a space, though many operators auto-prune leading/trailing spaces when going strings together.
For simple instructions, don’t add white space unless you know it is needed, which is normally never, except inside literal string values (i.e. quote enclosed text).
In my example code earlier I’ve used both forms to help indicate the space doesn’t matter. Clearly it had the opposite effect. So, copy/paste safe approach:
$Color="red";
but easier to read:
$Color = "red";
For operators like if that use parentheses ( ) for input arguments and brackets { } for conditional branches, simple rule:
if(argument){conditional branch...
White space in never allowed before operator parentheses:
someOperator (arg); // FAIL!
someOperator(arg); // OK
However, I think, white space is allowed between the parentheses and the baskets:
if(condition){code...
// and
if(condition) { code...
I use white space more in short code expressions for clarity/ease of reading but remove the in longer codes for overall length. There is no one-size-fits-all rule here.
Note to self. I thought aTbRef had a note specifically on white space. If it did, it seems to have gone astray so likely that’s one for the to-do spike.
I understand that syntax aspects like this are confusing. Even software coding is full of ‘rules’ that are open to interpretation and choice. It is simply something we all have to learn rather than look-up as describing the ambiguity often only adds ambiguity. Indeed, in aTbRef I periodically review all notes for abbreviations that have crept in. "Don’t do…’ might seem less formal, but “Do not do…” means the same and is less ambiguous and more helpful to those whose first language isn’t English. Such contractions are natural in writing, so gently creep back in until the next purge!