js switch case warning

I wrote a simple code below but I get a warning that is “assets/Scripts/Global.js(5,17): BCW0023: WARNING: This method could return default value implicitly.”

#pragma strict

public static class Global{ 

public function checkValueOfTag(str_tag : String) : int{
    switch (str_tag)
    {
    case "num0":
        return 0;
    case "num1":
        return 1;
    case "num2":
        return 2;
    case "num3":
        return 3;
    case "num4":
        return 4;
    case "num5":
        return 5;
    case "num6":
        return 6;
    case "num7":
        return 7;
    case "num8":
        return 8;
    case "num9":
        return 9;
    default:
    	return 0;
    }	
}

}

To explain the warning. The compiler is not sure if every path in your code returns a value. The warning is saying that there is a possibility that the function won’t return a value, and the default will be used instead. The default for int is 0.

The typical way to deal with this is to add a return at the very end of your function. Note that this is a warning, not an error. You can ignore it if you choose. Your code in the comments does make the warning go away, but it’s not the most efficient way to do so. Local variables will need to be allocated.

function DoStuff () : int {
    // Stuff
    return 0;
}