Ask coding questions

← Back to all posts
Minimum and Maximum Intergers?
WaffleSlayer (1)

I'm trying to program in a minimum and maximum number for a value to go up or down to. Is there any way I can do that in the dictionary that the integer is in, or do I need to import something for that? I know I can code in fail safe systems, but I was wondering if there was a way to make it so that it just cant go above or below certain numbers period.

SixBeeps (5061)

Here's some pseudocode for what you need.

set the variable to a number
if the variable is greater than the max
    set the variable to the max
else if the variable is less than the min
    set the variable to the min