Boo error?

I don’t know if this is just the new Unity beta, but have not seen any reports of this error:

BCW0023: WARNING: This method could return default value implicitly.

It occurs when I use #pragma strict, which is what I’m trying to do. Convert a javascript code from normal to strict. Here is the offending code:

function CheckGUIScore() : int
{
	var checkscore : int;
	if(scoreObject)
	{
		var textMesh : TextMesh = scoreObject.GetComponent(TextMesh);
		checkscore = parseInt(textMesh.text);
//		return parseInt(textMesh.text);
		return checkscore;
		
	}
}

As you can see, I’ve tried to declare the return as static, but it still generates the warning. It doesn’t prevent the code from running, but I’d like to get rid of all errors. Anyone know how to fix this?

A search online shows this to be a Boo error code, but the examples appear to be written in C#.

Deleting : int right after the function generates the same warning.

Bryan

you need to add a return after the if cause you have no default return in case the if would be entered

Thanks! So obvious! -

function CheckGUIScore() : int
{
   var checkscore : int;
   if(scoreObject)
   {
      var textMesh : TextMesh = scoreObject.GetComponent(TextMesh);
      checkscore = parseInt(textMesh.text);
//      return parseInt(textMesh.text);
      return checkscore;
      
   }
return;
}