Web anvari.org
Anvari.Org
» Anvari.Org

Quote #519 My favorite PL/I type conversion example:

Quote #519

My favorite PL/I type conversion example:
Declare A, B, and C as three-character strings. B='123';C='456';A=B+C;
What does A contain? PL/I automatically coerces strings to decimal numbers
in arithmetic context, so it correctly converts B and C and adds them to
get 579. Then it converts it back to a string of a default length,
which is ' 579'. Then it truncates the string from the right, so the
result is ' '. Oops. -John

Related:




Retrieved from http://www.anvari.org/fortune/Quotations_-_Random/4959_quote-519-my-favorite-pl-i-type-conversion-example.html