Math.Clamp Not being to understand how it works

I dont really understand how math.clamp is supposed to be used such as

print(math.clamp(0,1,10))

why is this printing 1 except of 10 as the number x is 0 and the max number is 10 so it should print 10 and how it is actually 1 and the reason for it

1 Like

Because the minimum argument is set to 1.

math.clamp clamps the first argument so if it’s less than the minimum value it’ll be the minimum value and if it’s greater than the maximum value, it’ll be the maximum value.

2 Likes

Thank you for explaining it to me :))))))