Nothingness & Null (sample training material)
Published on
Here is a sample of training material for "Introducting ColdFusion on Wheels" on May 10 through May 11 before CF.Objective() in Minneapolis. One of the begining iterations we will cover is "CFML In 100 minutes". Hopefully getting the class on the same level to learning CFWheels. There are only 3 seats left for the class so please sign up.
10. Nothingness & Null
What is nothingness? Is there nothingness only in outer space? Really, when we think of nothing isn’t it just the absence of something? Ok, that’s too much philosophy ColdFusion did not have a way of referring to nothingness until version 9. ColdFusion can recieve a
COLDFUSION
NULL
COLDFUSION
NULL
COLDFUSION
NULL
COLDFUSION
NULL
COLDFUSION
NULL
COLDFUSION
IsNull()
COLDFUSION
NULL
COLDFUSION
true
COLDFUSION
false
COLDFUSION
0
COLDFUSION
makeeggs
COLDFUSION
NULL
Tag |
---|
<cffunction name="makeeggs" returnType="component"> <cfargument name="quantity" type="numeric"> <cfif (IsNull(arguments.quantity)) /> <cfset this.makeEggs = "How am I supposed to make nothingness number of eggs?" /> <cfelse> <cfset this.makeEggs = "Making your #arguments.quantity# eggs!" /> <cfset this.yourEggs = ArrayNew(1) /> <cfloop condition="#ArrayLen(this.yourEggs)# LT #arguments.quantity#" /> <cfset ArrayAppend(this.yourEggs, "Making an Egg.") /> </cfloop> </cfif> <cfreturn this /> </cffunction> |
Script |
---|
public component function makeeggs(numeric quantity){ if(IsNull(arguments.quantity)) { this.makeEggs = "How am I supposed to make nothingness number of eggs?"; } else { this.makeEggs = "Making your #arguments.quantity# eggs!"; this.yourEggs = ArrayNew(1); while (ArrayLen(this.yourEggs) < arguments.quantity) ArrayAppend(this.yourEggs, "Making an Egg."); } return this; } |
Reload the file, call
COLDFUSION
frank.makeeggs(3)
COLDFUSION
frank.makeeggs()