Pages: [1]   Go Down
Author Topic: For loop initializer, and increment  (Read 422 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 0
Posts: 547
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: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


for does not care about data-types.
Logged

Offline Offline
God Member
*****
Karma: 0
Posts: 547
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: 64
Posts: 6055
Baldengineer
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

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Pages: [1]   Go Up
Jump to: