Use the same input key

Hi guys, i tried to set this script for use the same input key, but it dosn’t work…
How can I do?

using UnityEngine;
using System.Collections;

public class Luci4 : MonoBehaviour {
	
	public Material material1;
	public Material material2;
	
	
	void Start ()  {
		
		renderer.material = material1;
		
	}
	
	void Update () {
		
		if (Input.GetKeyDown (KeyCode.Alpha4)) 
		{
			if (Material != material1)

			{
				Material = material1;

			}

			else

			{
				Material = material2;

			}

	}
	
}
}

This is the correct code.

using UnityEngine;
using System.Collections;

public class Cube4: MonoBehaviour {
	
	public Material material1;
	public Material material2;
	
	
	void Start () {
		
		renderer.material = material1;
		
	}
	
	void Update () {
		
		if (Input.GetKeyDown (KeyCode.Alpha4))
		{
			if (renderer.material != material1)
				
			{
				renderer.material = material1;
				
			}
			
			else
				
			{
				renderer.material = material2;
				
			}
			
		}
		
	}
}