Creating a grade from a variable

so im trying to take a single variable and create a graded score based on it

as an example the range would be from under 10 to over 29.

I split that into 5 groups

= 29 = 5
29-25 = 4
24.99-15 = 3
14.99-10 =2
<=10 =1

the problem I am having is I can not find a math block that allows me to say that if the value of the variable is between 29 and 25 set grade varible to 4

This question came up recently… please see this post and let me know if it answers your question:

i was able to come up with this solution, and it works fine for what I need. what tripped me up was that I did not find a math block to give a set range between two numbers to pair with the if-then block

Right, there isn’t a “range” block so that’s the solution I typically use. You can, if you want, create a range with the AND (logic) block. So you could say if app variable grade >= 0 AND app variable grade <=10… and that would be the same as 0 <= x <=10.

I actually wrote a function in Thunkable a while ago that takes a list of numbers such as 29, 25, 15, 10, 0, and then using a loop creates the conditions for everything you have in your screenshot. It’s pretty hard to wrap your mind around so I don’t recommend it but it is something I can use over and over instead of having to create all of the individual blocks like in your screenshot.

It’s probably not going to make a lot of sense but this is what it looks like:

image

image