if get key down unity

C#
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        if (Input.GetKeyDown("space"))
        {
            print("space key was pressed");
        }
    }
}if (Input.GetKeyDown(KeyCode.Space))
        {
            print("space key was pressed");
        }
Source

Also in C#: