Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

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

Select an option

Save trycf/fd1453abd8f59f7ff55889e8b9fa2217 to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
boolean function isBool(any val) {
return isValid("boolean", arguments.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