Sunday, May 10, 2009

groovy tip #3534

by Richard Vowles

Don't do integer arithmetic in gstrings.


int time = 1730
println "${time/100}"



I know Mars Edit is going to screw up that code block. Anyway, although time is an int, it gets converted to a BigDecimal in the gstring, and you get a 17.3 instead of the expected 17.

And last but not least, our first Illegal Argument podcast has gone out. It hasn't shown up on iTunes yet, hopefully that will be soon.

Post a Comment