Loading...
Pages: [1]   Go Down
Author Topic: For loop initializer, and increment  (Read 237 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 0
Posts: 503
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does 'for(;;)' accept floats? Or will Inflate to integers then downscale within the loop code for use in calculations?
« Last Edit: May 06, 2012, 03:58:47 pm by Coding Badly » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 117
Posts: 10144
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


for does not care about data-types.
Logged

Offline Offline
God Member
*****
Karma: 0
Posts: 503
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was curious because my polar functions returned abnormally fast, ie the mechanics didn't move at all. i did however note that I had not explicitly typcast back to integer when saving the results to my integer based coordinate points.
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 41
Posts: 5166
CMiYC
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Does 'for(;smiley-wink' accept floats? Or will Inflate to integers then downscale within the loop code for use in calculations?

From the for() reference page (http://arduino.cc/en/Reference/For):
"Also the statements for initialization, condition, and increment can be any valid C statements with unrelated variables, and use any C datatypes including floats."
Logged

www.cmiyc.com - A guide to being an Enginerd

Pages: [1]   Go Up
Print
 
Jump to: