howartp wrote:I’m thought that initially, but it’s actually a clever way of rounding to 2 D.P.
I’ve done the same myself before now.
It may be that once AppleScript has X as an integer, it retains it as integer, so dividing by 100 would do as Carl says - ie the last four rows round off the value of RainSeason to a whole number.
Either way, the earlier setting of the variable is superfluous as it's overwritten by either a 2DP or whole number.
ckeyes888 wrote:The script just rounds off the RainSeason variable to a whole number…doesn’t add the rainDay to it.
Thanks,
Carl
It DOES add rainDay to it.
The first section adds rainDay to rainSeason then stores it back into RainSeason.
The second section re-grabs RainSeason (which has now been incremented) then rounds it off to either 2DP or integer.
DaveL17 wrote:I'm confused. Isn't that what this line does?
- Code: Select all
set rainSeason to rainSeason + rainDay
Yes.