How can I limit a property?

I have a property which is used as a number in a script, the property is a float property, and is changed by the up and down arrow keys. The script is a nightvision script, so if I don’t limit the property, it will become either too bright or too dim (adjustable nightvision).
So how can I limit a property, to 4 and -1? Because I don’t want to write a separate script per level of nightvision!


if property > 4 then property = 4
if property < -1 then property = 1

This can be done via logic bricks, but I wouldn’t recommend it. :smiley:

if property < -1 then property = - 1

Thanks! So simple!
Yeah, I’ll stick with Python.