✅ Trying to round a value but there's seemingly no elegant way to do it?
I've tried two versions (seen here: https://paste.ofcode.org/HXfb53WkUWfRCz8mvTpQTg)
But the first (more elegant solution) doesn't work and the second seems unnecessarily backwards?
5 Replies
you have to do something like
(int)Math.Round((double)guessDistance / 10) * 10;
guessDistance / 10
does not do what you want. it produces an integer as the result
it has already truncated the answer, rounding will not do anythingOh, so because I want to divide it, it needs to be a decimal/double!
!solved
$close
Use the /close command to mark a forum thread as answered
thanks