Created
March 15, 2012 18:19
-
-
Save mhenke/2045802 to your computer and use it in GitHub Desktop.
example of another way to handle neq 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>NEQ 0</h2> | |
<h3>try -1,0,1,8</h3> | |
<cfdump var="#testneq0(-1)#"><br> | |
<cfdump var="#testneq0(0)#"><br> | |
<cfdump var="#testneq0(1)#"><br> | |
<cfdump var="#testneq0(8)#"><br> | |
<h3>try list</h3> | |
<cfdump var="#testneq0("ringo,john,paul,george")#"><br> | |
<cfdump var="#testneq0("0,1,2,3")#"><br> | |
<h3>try string</h3> | |
<cfdump var="#testneq0("")#"><br> | |
<cfdump var="#testneq0(" ")#"><br> | |
<cfdump var="#testneq0("beatles")#"><br> | |
<cffunction name="testneq0"> | |
<cfargument name="myargument" required="true" /> | |
<cfset arguments.myReturn = {} /> | |
<cfset arguments.myReturn.complex = false /> | |
<cfset arguments.myReturn.simple = false /> | |
<cfif arguments.myargument NEQ 0> | |
<cfset arguments.myReturn.complex = true /> | |
</cfif> | |
<cfif not isnumeric(arguments.myargument) or arguments.myargument> | |
<cfset arguments.myReturn.simple = true /> | |
</cfif> | |
<cfreturn arguments.myReturn> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment