Turning pieces of code into a method

Hello everyone. I was wondering about using methods to group some lines of code.
For example:

    void FixedUpdate()
    {
        if (canJump)
        {
            playerRb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
            canJump = false;
            onGround = false;
        }
    }

turning into this

    void FixedUpdate()
    {
        Jump();
    }
    private void Jump()
    {
        if (canJump) 
        {
            playerRb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
            canJump = false;
            onGround = false;
        }
    }

Do these both work exactly the same? Are there any benefits/downsides of doing so, besides making code more readable/cleaner?

yup that is how you do it and it doesn’t just make it more readable abs cleaner it makes it easier to debug and maintain, it makes it more modular and portable, increases code reuse. Code reuse is a really great quality.