How do I make my character animations work?

I need a walk sprint and idle animation script all in one when shift + uparrow is pressed he sprints and when shift is released it continues walk animation please help.

switch (yourCharacterState) {

case charSate.Idle:
play "idle";
break;
case charState.Sprint:
play "sprint";
break;
case charState.Walk:
play "walk";
break;
}

I think this is a good use case for an Enum. You set charState based on Input(get.axis) values or other game logic. That’s psuedocode, adopt to your language.