How to round numbers?

Twine Version: 2.3.7
Story Format: Harlowe
Hello, this is probably a very dumb question, but how do you round numbers for output?
For example :
$var = 12.423
I want to print just the whole part (12) without changing the $var. How do I do that?

https://twine2.neocities.org/#macro_floor

I think you would just do the thing that makes it where if the variable is below a certain variable and above another one it goes to the variable that I want it or round to. Also this isn’t stupid. But could you tell me if these are set variables or randomized ones?

That’s called “rounding”. :stuck_out_tongue: Harlowe 3.3.8 manual
However, Danijela specifically asked for only the whole number, which is what floor does.

But could you tell me if these are set variables or randomized ones?

Who is this being asked to? Danijela? Because Chapel successfully answered their question two months ago, and whether it’s set or randomized wouldn’t change anything in either case.

2 Likes

Oh never even noticed it was already answered, just looking for questions and trying to answer them to the best of my ability. Sorry, will pay attention next time.

There’s also a good chance that within two months the person stopped caring or solved it themselves. I doubt they halted their project for months until someone on the forum told them which function to use. :stuck_out_tongue:

That’s why I don’t usually answer questions more than a couple days old. I just assume the person figured out some solution or alternative on their own.

Answering old questions can help people with similar problems who are googling for answers, though.

1 Like

One thing I keep in mind when answering a question is that it’s quite likely that other people may want to know the answer too, or at least an answer to a similar question. (smile)