sum Action Determined by Format - Caveat

In version 7 and later, the format (first) argument to <sum> determines its behavior - string formats cause concatenation, numeric formats cause addition. In previous versions, the type of the following arguments determined behavior, i.e. numeric addition only happened if all arguments following the format were parsably numeric. This change clarifies <sum> behavior when the non-format arguments are unknown: it is no longer necessary to add a dummy empty string argument to force concatenation.

Caveat: Existing <sum> statements with a string format (%s) but numeric arguments will return different results in version 7 than in version 6.

For example:

<sum "%s" 1 2 3 4>

will return the string "10" in version 6: numeric addition first due to numeric arguments, then conversion to string by the format. But in version 7, this will return the string "1234": the format causes string concatenation. See the Vortex manual on <sum> (here) for more details. This behavior change is rolled back if <vxcp compatibilityversion> is set to 6.

Copyright © Thunderstone Software     Last updated: Oct 24 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.