How can i limit my speed?

i tryed this but it doesn’t work every time i start my game my current speed is maxspeed?
anyone who can help?
if(currentSpeed <= MaxSpeed){
current = MaxSpeed;
}

That says:

If currentSpeed is less than or equal to MaxSpeed then set current to MaxSpeed.

I think you mean to have this:

if(currentSpeed >= MaxSpeed){
    current = MaxSpeed; // should this be currentSpeed not current?
}