Re: Clock-like looping
Re: Clock-like looping
- Subject: Re: Clock-like looping
- From: Daniel Richman <email@hidden>
- Date: Sun, 29 Jun 2008 10:39:14 -0700
Sorry, I just realized that won't work for floating point numbers. But
you can check if the number is an integer first, then use the % operand
if so.
Daniel
Daniel Richman wrote:
Use
double newNumber = oldNumber % 13;
This will return your number's remainder when dividing between 13,
which could be 0 - 12.
Daniel
Ashley Perrien wrote:
Is there a fairly simple way of setting up a clock style looping of
numbers? Where 1-12 act normally but 11 + 2 would return 1 and so on.
I'm not doing time and would be dealing with ranges from 1 to 96, 77,
120, that type of range. Would also need to be able to handle partial
numbers (4.125 for instance). Any tips on where to look or is it just
a lot of manual checking to make sure the number are within the
correct range?
Ashley
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden