Passing parameter problems :(

So I’m doing some digital tutor lessons, I’ve copied the demo identically as far as I can see (clearly there’s something I’ve missed) I’ve watched the specific part several times, and I am still not finding the problem. So if someone could kindly tell me what I’m missing that would be just dandy.

function Update () {
	if(Input.GetKeyUp("space")){
		WeaponSearch();
	}
	

}

function WeaponSearch (){
	weapon = Random.Range(1, 5);
	
	switch (weapon){
	
		case 1: 
			weaponName = "sword";
			DisplayMessage(weaponName);
			break;
		case 2:
			weaponName = "axe";
			DisplayMessage(weaponName);
			break;
		case 3:
			weaponName = "bow";
			DisplayMessage(weaponName);
			break;
		case 4:
			weaponName = "dagger";
			DisplayMessage(weaponName);	
			break;
		default:
			Debug.Log("You need to find a weapon!");
	}

}

function DisplayMessage(weaponName){
	
	Debug.Log("You found " + weaponName + "!");
	
}

The error I get is that weaponName is an unknown identifier. The lecturer doesn’t use a variable at the top, he talks about passing parameters, yet I get an error and his works fine.

At the top of the script where you declare your variables add this line:

string weaponName;

The problem is that you have not declared you weaponName variable. That’s it.