<cfloop from="1" to="6" index="i">
        <cfoutput>#i# - <cfif i mod 2>Odd<cfelse>Even</cfif><br></cfoutput>
</cfloop>

i mod 2 gives you the remainder from dividing by 2.  If there IS a remainder
- meaning i mod 2 is not equal to zero, and therefore "true" - then the
number is odd.

Dan

-----Original Message-----
From: Jason Larson [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 20, 2000 7:58 AM
To: CF-Talk
Subject: Finding an Odd Number

Can someone help me out?

I have a cfloop that loops 6 times, I want to be able to be able to output
what loop number the current loop is on, and tell if the number is even or
odd.

Any help would be greatly appreciated

Thanks
Jason Larson
[EMAIL PROTECTED]


The information contained in this message is privileged and confidential.  It is 
intended solely for the use of the named recipient.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, or use 
of the contents of this transmission is strictly prohibited.  If you receive this 
message in error, please notify the sender immediately.  Thank you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to