How do you write this in twine?

How does one write something like if $fat is 10 through 19 instead of this?

Ah, making a game are you? I don’t know but i guess you can try if and elif statements, I mean I really only learned Python coding so i guess it could be about the same. For example, to lock in a certain range in Python, there can be:
if (a (insert < or <=) input (insert < or <=) b):
insert code here
That’s what I know!
I guess you could try (if:$fat >=10 and $fat<20), i really don’t know how twine works.

1 Like

Thanks, I got it to work

Simple answer is:

(if:$fat >= 10 and $fat < 20)["Skinny"]

If you have a response for each value of fat then a chain of if/else-if/else is easier and clearer:

(if:$fat < 10)["0..9: skeletal"]
(else-if:$fat < 20)["10..19: skinny"]
(else-if:$fat < 30)["20..29: normal"]
... and so on until ...

Each test doesn’t need to check a range as the earlier tests have already excluded the lower values.

If you are using these weigh classifications in more than one place, consider deriving another value such as size from fat that has only one value for each description. You could use a function to do this.