But old habits die hard, and I'm still inclined to list most or all of my variable declarations at the beginning of a script. If the default value-class assignment is not the correct interpretation for use in our script, you might expect that we would encounter an error. Luckily for us, we can test to determine the value class of any variable in our script if we think it's causing a problem in our script. But we know that we want to use this entry in our script to perform a calculation. Now we have something that we can use in a calculation at a later point in the script.
Coercion is the process whereby a value of one class is converted to a value of a different class.
This is a rather important topic in AppleScript, and we'll be revisiting it often to increase our understanding of it. AppleScript, as it turns out, is very good about making implicit variable declarations and coercions based on context. In fact, it's remarkable how seldom it gets it wrong. Copy the example below to the Script Editor and see what you get in the result window. AppleScript is pretty clever.