Displaying the value of a variable? (Solved)

This may sound like the most noobish question ever, but I’ve been using Unity for less than a week.

how can I display the value of a variable as part of my GUI?

I tried the following code:

var val = 1;
function OnGUI () {
	GUI.Label (Rect (10,10,150,100), val);
	}

When the variable is a string it works, but not when the variable is a numeric value. So how do I display a numeric value

You need to provide a string, luckily most variable types have a function called ToString so in your case you could use

var val = 1; 
function OnGUI () { 
   GUI.Label (Rect (10,10,150,100), val.ToString()); 
   }

Thanks a bunch! That worked perfectly!