Arm rotation question

Hey…
i did this script for move an arm up and down, but is not how I wanted to…

in this script, if i press Z or X the arm moves up and down continuously … why? i would like that if i press Z the arm go up end if i press X go down… hope someone can help me !

thank you in advance

you can move many time:

  1. if (Input.GetKey (KeyCode.Z)) {

       arm_rot = (Mathf.Sin (arm_sin) * 30.0f) - 30.0f;
       arm_sin = (arm_sin + Time.deltaTime * 5.0f) % 360.0f;
    
       int i = 0;
    
        if(i<arm_rot){arm[0].transform.localEulerAngles =
    

    new Vector3 (i, 0.0f, 0.0f );
    i++;}

       }