Problem scenario
A Groovy program is returning an incorrect value for an integer variable. What is wrong?
Possible solution #1
Check the logic of your program. Use the println
command to see the earliest point when this variable is assigned an incorrect value. This helps you pinpoint the problem.
Possible solution #2
Is the variable being assigned a number in quotes like this?
int i = "0"
You should remove the quotes from the numeral zero.