Where does the semi colon go?

This is my script, it says i need a semi colon, where do i put it?

int var score : int = 10;

function OnGUI()
{
	GUI.Label(new Rect(Screen.width/5-100,Screen.height/5-90,300,30), score);
}

2 Answers

2

Are you coding in Javascript or C# ?

its either Javascript:

var score : int = 10;
function OnGUI()
{
    GUI.Label(Rect(Screen.width/5-100,Screen.height/5-90,300,30), score);
}

or C# (C-sharp)

int score = 10;
void OnGUI()
{
    GUI.Label(new Rect(Screen.width/5-100,Screen.height/5-90,300,30), score);
}

Your problem is with this line of code

int var score : int = 10;

You need to remove the int at the beginning, so it should be…

var score : int = 10;

looks like you're getting javascript mixed up with a c-like language...

What does that comment have to do with my answer?