—,
Whichever behaviour you're using, it'd be worth familiarising yourself with the 'clamp' expression - it's very useful for a bunch of situations in which you want to constrain a variable between a minimum and maximum value.
It takes the form clamp(value, max, min). The handy thing is that the 'value' part can be a variable or expression itself. So in your case, for example you might have a 'speed' instance variable on Mario. You could then use the following code:
On right arrow down: Set Mario.speed to clamp(self.speed+1,-10,10); Set Mario.X to self.X+self.speed
On left arrow down: Set Mario.speed to clamp(self.speed-1,-10,10); Set Mario.X to self.X+self.speed
This would increase or decrease Mario's speed by 1 each tick depending upon which direction key is held down and then move Mario in the given direction.
Remember to reset the speed to 0 when no key is pressed, or divide the speed each tick after release to allow deceleration.
Alternatively check out the 'max' and 'min' expressions in the manual - they can be used in a similar way to limit the range of a variable.
You should also familiarise yourself with using dt time to ensure frame rate independent movement - there's a bunch of tutorials, forum posts and manual entries on how to use it - a quick search should point you in the right direction.