2D Game - Y axis rotation (left - right)

Hello everyone, i’m doing a simple 2D Game.
Of course, trough < and > arrows you’re allowed to walk.
I made idle and walk animations successfully, now i would like to rotate my sprite to left when he’s walking to left, and to right when he walks to right.

I tried many rotation functions but i made some mistakes, can i know the right way?
P.S: I’m using C#.

Here’s my Player code:

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {
	
	public float Speed = 4;
	public float position;
	
	protected Animator animator;
	
	void Start () {
		animator = GetComponent<Animator>();
		position = transform.position.x;
	}

	void Update () {
		position = transform.position.x;
		transform.Translate(Vector3.right * Input.GetAxis("Horizontal") * Speed * Time.deltaTime);
		
		if(position < transform.position.x) {
			animator.SetBool("WalkVar", true);
		} else if(position > transform.position.x) {
			animator.SetBool("WalkVar", true);
		} else {
			animator.SetBool("WalkVar", false);
		}
	}
}

Here is a tutorial:

Thank you!