How do I make an animation change based on an integers value.

I code in Java with Unity, and I am not very familiar with Java quite yet. I am also fairly new to Unity, but the goal I am looking to accomplish is to have an animated model change its animation based on a value.

Currently its Walk will equal 1, Jog = 2, Run = 3, and I need the value to be able to be input by the player. Nothing fancy, just a rectangle on the screen that can be modified by pressing the number 1, 2 or 3.

Honestly, if anyone can just point out to me where to start, and which functions I would want to use, it would be greatly appreciated.

Something to this effect:

void OnGUI()
{
        if(Input.GetKeyDown(KeyCode.Alpha1))
        {
                animation.Play("Walk");
        }
        else if(Input.GetKeyDown(KeyCode.Alpha2))
        {
                animation.Play("Jog");
        }
        else if(Input.GetKeyDown(KeyCode.Alpha3))
        {
                animation.Play("Run");
        }
        //etc...
}

if(Input.GetKeyDown(KeyCode.Alpha1))
{
animation.crossfade(“Walk”);
}
else if(Input.GetKeyDown(KeyCode.Alpha2))
{
animation.crossfade(“Jog”);
}
else if(Input.GetKeyDown(KeyCode.Alpha3))
{
animation.crossfade(“Run”);
}