Im trying to make a range block but I am having troubles

I am currently trying to create a custom block that when you put a input number in the first box it will report that number when it is in the range of numbers between input 1 and input 2.

https://snap.berkeley.edu/snap/snap.html#present:Username=fnafgamer239&ProjectName=lab%2010

the custom block is in operators and is named "snap <> to range <> <>
(idk why it wont let me embed the script pic)

image
you could just use ( (number) min (number) ) and ( (number) max (number) )
operators

image
also, this is wrong, cuz it will only report if the number is equal to input1 or input2, but it won't work if the number is inbetween (you should've done it like that,
< < (number) ≥ (input1) > or < (number) ≤ (input2) > > )

oh yea ik that i just have that there bc it's a requirement for my assignment for this block

alr thank you ill try that when i get home

It's always a good idea to declare that something is for an assignment, so that we can help steer you towards working out a solution for yourself ,rather than just giving you one :slight_smile:

oh okay mb... ill do that from now on whenever I need help

so this didnt work. i need it to say the input number if it IS inside of the range and if its outside of the range of those two numbers it says the closest range number

ive tried a lot before i came to the forums bc I like doing it myself but I am very confused by this

nvm i figured it out thank you for the help

Excellent :slight_smile: Well done :slight_smile:

How exactly is this requirement worded?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.