Tap vs touch controls

I’m creating a movement script where the player must tap either the left or right side of the screen. Currently my script is working however I can simply hold my finger on the screen to move continuously in the respective direction. It shouldn’t be allowed to happen. How can I change it so that it only registers a tap and not a touch/hold?

void Update()
    {
        if (Input.touchCount > 0)
        {
            var touch = Input.GetTouch(0);
            float jumpVelocity = 3f;
            if (touch.position.x < Screen.width / 2)
            {
                rigidbody2d.velocity = (Vector2.up * jumpVelocity) + (Vector2.left * jumpVelocity);
            }
            else if (touch.position.x > Screen.width / 2)
            {
                rigidbody2d.velocity = (Vector2.up * jumpVelocity) + (Vector2.right * jumpVelocity);
            }
        }
    }

Hey @bobmcdonal .
Every touch on screen has property called TouchPhase

you can know the phase of your touch by read its value .
so simply do edit your code to this :

void Update()
     {
         if (Input.touchCount > 0)
         {
            var touch = Input.GetTouch(0);
            switch (touch.phase)
            {
                         //When a touch has first been detected record the starting position
                case TouchPhase.Began:
                         // Record initial touch position.
                    var   startPos = touch.position;
                    break;

                        //Determine if the touch is a moving touch
                case TouchPhase.Moved:
                       // you dont need this one 
                    break;

                case TouchPhase.Ended:
                    // Report that the touch has ended when it ends
                   var endpos= touch.position;
                    if(startpos==endpos)
                        {
                           float jumpVelocity = 3f;
                           if (touch.position.x < Screen.width / 2)
                           {
                              rigidbody2d.velocity = (Vector2.up * jumpVelocity) + 
                              (Vector2.left * jumpVelocity);
                           }
                           else if (touch.position.x > Screen.width / 2)
                           {
                            rigidbody2d.velocity = (Vector2.up * jumpVelocity) + 
                            (Vector2.right * jumpVelocity);
                            }
                         }
                    break;
            }

         }
     }

best regard Fariborz