![]() ![]() ![]() |
The following examples demonstrate ColdFusion's typeless expression evaluation.
2 * TRUE + "YES" - ('y' & "es") Value as string: "2"
Explanation: (2*TRUE) is equal to 2; ("YES"-"yes") is equal to 0 because "Yes" converts to 1. And, of course, 2 * 0 equals 0.
TRUE AND 2 * 3 Value as string: "YES"
Explanation: 6 is TRUE as a Boolean; TRUE AND TRUE is TRUE.
"Five is " & 5 Value as string: "Five is 5"
Explanation: 5 gets converted to the string "5".
DateFormat("October 30, 1998" + 1) Value as string: "31-Oct-98"
Explanation: The addition operator forces the string "October 30, 1998" first to be converted to a date-and-time object and then again converted to a number. The number is incremented by one. The DateFormat function requires its argument to be a date-and-time object; thus the result of the addition is converted back to a date-and-time object. The addition of 1 has moved the date one day ahead.
![]() ![]() ![]() |
AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.