Skip to content

Instantly share code, notes, and snippets.

Created July 18, 2012 21:21
Show Gist options
  • Save anonymous/3138979 to your computer and use it in GitHub Desktop.
Save anonymous/3138979 to your computer and use it in GitHub Desktop.
Fizz Buzz
<!--- cf function that solves the fizzbuzz test --->
<cffunction name="displayFBMsg" access="private" hint="whatever...">
<cfargument name="numberOfIterations" required="true" type="numeric">
<cfloop from="1" to="#arguments.numberOfIterations#" index="i">
<cfif i MOD 3 EQ 0 OR i MOD 5 EQ 0>
<cfif i MOD 3 EQ 0>fizz</cfif><cfif i MOD 5 EQ 0>buzz</cfif>
<cfelse>
<cfoutput>#i#</cfoutput>
</cfif>
</br>
</cfloop>
</cffunction>
<!--- call the function --->
<cfoutput>#displayFBMsg(100)#</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment