✅ 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
reflectronic
reflectronic9mo ago
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 anything
Nomnomfighter
Nomnomfighter9mo ago
Oh, so because I want to divide it, it needs to be a decimal/double! !solved
reflectronic
reflectronic9mo ago
$close
MODiX
MODiX9mo ago
Use the /close command to mark a forum thread as answered
Nomnomfighter
Nomnomfighter9mo ago
thanks