function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Increment Decimals in for Loop? How? Help Please

Hi I need to increment decimals in my for loop but it is incrementing by 1...


for(Decimal zz=9.1;zz<9.4;zz++){ }

 It goes from 9.1 to 10 right away...

I need it to go from 9.1 to 9.2 to 9.3 to 9.4


Of course in my code the zz<9.4 will be a value from a list so something like student[0].term

Any suggestions on the incrementing?




Best Answer chosen by Admin (Salesforce Developers) 

Decimal myDecimal = 9.0;for(Integer i=0;i<10;i++){myDecimal+=0.1;System.debug(myDecimal);}