Unknown Identifier : Hunger?

Hello! I am very sorry that I am probably asking a very basic question. I am not that good at scripting in Unity. I am trying to create a script that will display when hunger = 0, the game restarts. This is my script that I want to fix:

#pragma strict

function Start () {
	var Hunger = 100;
}

function Update () {
	
}
function OnGUI()
{
  GUI.Label(Rect(0,0,100,100),"Hunger: "+Hunger);
}
function onHungerDeath() 
{
  if (Hunger <= 0) {

  Application.LoadLevel(0);
							
	}
}

Here is the error that is displayed:

 Assets/Scripts/variabledisplay.js(12,42): BCE0005: Unknown identifier: 'Hunger'.
 Assets/Scripts/variabledisplay.js(16,7): BCE0005: Unknown identifier: 'Hunger'.

Thank you for taking your team to help me.

You need to declare Hunger outside of the scope of a function, in the function it is not available and this doesn’t work like javascript and it’s closure.

Update your script like so:

#pragma strict

var Hunger: int;

 function Start () {
    Hunger = 100;
 }
 
 function Update () {
     
 }

 function OnGUI() {
   GUI.Label(Rect(0,0,100,100),"Hunger: "+Hunger);
 }

function onHungerDeath() {
   if (Hunger <= 0) {
       Application.LoadLevel(0);
   }
}