Check out example codes for "unity move script if else". It will help you in understanding the concepts better.

Code Example 1

moveInput = Input.GetAxisRaw("Horizontal");
if (moveInput > 0.5 || moveInput < -0.5)
{         
  rb.velocity = new Vector2(moveInput * moveSpeed, rb.velocity.y);    
}

Learn ReactJs, React Native from akashmittal.com