Help converting js to C# from Brackey's tutorial.

I’ve been watching the Brackey’s pong tutorials on youTube and I have been trying to convert his javascript to C#. I’ve done excellent up until this portion. Any help is appreciated. Video Link: Brackey’s Pong Tutorial Link

void Update () {
		var xVel : float = rigidbody2D.velocity.x;
		if (xVel < 18 && xVel > -18 && xVel != 0) {
			if (xVel > 0) {
				rigidbody2D.velocity.x = 20;
			}
			else {
				rigidbody2D.velocity.x = -20;
			}
		}
	}

void Update()
{
float xVel = rigidbody2D.velocity.x;

        if (xVel < 18 && xVel > -18 && xVel != 0)
        {
            if (xVel > 0)
            {
                rigidbody2D.velocity = new Vector2(20, rigidbody2D.velocity.y);
            }
            else
            {
                rigidbody2D.velocity = new Vector2(-20, rigidbody2D.velocity.y);
            }
        }
    }

That what your after?

The only line you should have to change is this one:

var xVel : float = rigidbody2D.velocity.x;

As C# is a strongly typed language, you just use the format type variableName = value, like this:

float xVel = rigidbody2D.velocity.x;

I’d really suggest that you learn how to translate back and forth, especially if you’re going to follow along with tutorials. A little goes a long way with that, as there seems to be a fairly equal distribution of people who use C# or JavaScript. If anything, it seems there are more people that use JavaScript.