for loop error

for(float z =0F; z<worldZ; z + snap)

What’s wrong with this? (worldZ and snap are floats)

Only assignment, call, increment, decrement, and new object expressions can be used as a statement.

First of all, you’re not doing anything.

z+snap does just the sum of the two parts, that’s it, no evaluation, it’s not pumping that value into a anything whatsoever, so that isn’t helpful to progress the loop.

Assignment can be done as you saw in your error/exception message. But you can use a short hand to achieve what i think you’re trying to do.

Either of these should work.

// long hand
for(float z =0F; z<worldZ; z = z + snap)

// short hand
for(float z =0F; z<worldZ; z += snap)

Also you don’t need the F for a float if it’s a whole number, only when using decimal. Its not enforced, your choice.