Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save trycf/3208c7a2f73c07fecb3de7c6e2949009 to your computer and use it in GitHub Desktop.

Select an option

Save trycf/3208c7a2f73c07fecb3de7c6e2949009 to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
boolean function isBool(any val) {
if (!isBoolean(arguments.val)) return false;
if (isString(arguments.val)) return false;
return (arguments.val == true || arguments.val == false);
}
values = [
"yes",
"no",
1,
0,
true,
false
]
for (i=1; i<=arrayLen(values); i++) {
writeOutput("<p>#values[i]# : #isBool(values[i])#</p>");
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment