A great new feature of ColdFusion 8 is its new implicit creation of Arrays and Structures. In addition to the updates to operators in ColdFusion, those of you familiar with JavaScript will recognise and welcome these changes.
An array is a data structure consisting of a group of elements that are accessed by indexing. In most programming languages each element has the same data type. However, ColdFusion, as we will see, is not strictly typed and therefore allows any data type to be stored in combination. This allows strings, integers, booleans and other complex data types all to be stored in the same array. However, doing this certainly isn't a good practice as it causes signification complication when accessing the stored data.
Variables of a simple data type commonly only store a single value but, in some situations, it is useful to have a variable that can store a series of related values - using an array. Arrays are described as complex data types because they can hold data in a structured, complex way. Read more – ‘Implicit Arrays in ColdFusion 8’.
In my first post in this series, I introduced Using JavaScript Arithmetic Operators in ColdFusion 8. Now we'll concentrate on Assignment operators.
An assignment operator assigns a value to its left operand based on the value of its right operand.
The basic assignment operator is equal (=), which assigns the value of its right operand to its left operand. That is, x = y assigns the value of y to x. The other assignment operators are usually shorthand for standard operations, as shown in the following table. Read more – ‘Using JavaScript Assignment Operators in ColdFusion 8’.
An often mentioned complaint by ColdFusion developers is the lack of operators commonly found in other programming languages such as JavaScript. For example, instead of the greater-than (>) symbol we have been restricted to the more wordy GT or GREATER THAN operator. However, in ColdFusion 8 this has changed and we have more freedom to use familiar JavaScript operators in blocks.
In the following series of posts, I will introduce the changes and show some simple examples. The first in the series is Arithmetic Operators.
Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/).
These operators work as they do in most other programming languages. Read more – ‘Using JavaScript Arithmetic Operators in ColdFusion 8’.