http://www.perlmonks.org?node_id=1113535


in reply to Re^3: Convert undef to empty string in a hash
in thread Convert undef to empty string in a hash

"...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»

  • Comment on Re^4: Convert undef to empty string in a hash

Replies are listed 'Best First'.
Re^5: Convert undef to empty string in a hash
by Anonymous Monk on Jan 16, 2015 at 18:44 UTC
    Ada is dead, but Pascal (Free Pascal and Delphi) does have += and stuff :)
      "Ada is dead..."

      Yes sure. And my cell phone is stronger than your fax machine.

      Regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

Re^5: Convert undef to empty string in a hash
by Anonymous Monk on Jan 17, 2015 at 01:08 UTC