"...is better written as..."
Yes and no. I'm a bit unsure about this. Please see Assignment and increment operators (like += and ++ in C)" for a pascalish or adaistic point of view about this - as you like:
"Ada provides these computations, of course, but not as special operators. Their exclusion is a judgement call. In some cases, they can make individual statements simpler to read. Overall, most code is clearer and more reliable without them. It's easy to misread "x += expression" as "x := expression" instead of "x = x + expression", especially if this line is buried in a sequence of assignments with varying assignment operators. Further, typos are less likely to result in valid (but erroneous) code. Note that "+" and "=" are on the same key on most keyboards, and "-" is next to it. "+=" and "-=" are easy fumbles for "=", or for each other."
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
In reply to Re^4: Convert undef to empty string in a hash
by karlgoethebier
in thread Convert undef to empty string in a hash
by ibm1620
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |