repl
. Every time you assign a value to a variable, the CommandBox REPL will output or echo the variable for you. Please note that in REPL mode the termination for a line of code is omitted. A line terminator in ColdFusion is the ;
.a
and reference it as A
they are the same. This can be a very big gotcha for developers coming from languages like Java or JavaScript. However, as best practice, we would recommend to ALWAYS use the same case as when you define the variable:a
is now an array.#
operators and using the variable name:#
hashes for output on assignments can be redundant:<cfdump>, writeDump()
and <cfabort>, abort;
. These are used to dump the entire contents of a variable to the browser, console or even a file. You can then leverage the abort
construct to abort the request and see the output of your dumped variables. This will work with both simple and complex variables. However, be very careful when using it with Nested ORM objects as you can potentially dump your entire database and crash the server. Leverage the top
argument to limit the dumping.<cfparam>
tag or the param
construct:isDefined()
- Evaluates a string value to determine whether the variableisNull()
- Returns true
if the specified object is null, else false
.structKeyExists( key, value )
- Verifies if the specified key variable exists in a structure.String, Int, Float, Array, Vector, HashMap, etc
. This is important because each variable you create has member functions available to you that delegate or reflect back to its native Java class.java.lang.String
. Therefore, the variable is typed as a String and can call on any method that java.lang.String
implements. You can try this for the many types in CFML like structs, arrays, objects, etc.