implicit downcast from object to int, but why? and what?

So, this is +/- what i’m looking at:

var Word :String ;
var WordinUse = [] ;
var Database = ["eu","joao","lampada"] ;

function Start () {
	var RandomNumber ;

	RandomNumber = Random.Range(0, 4);

	Word = Database[RandomNumber];

Unity gave me a warning on this last line, that says what the tittle says. It doesn’t make much sense to me as i had previously declared Word as a string, but even if i hadn’t everything on Database is a string so why would it downcast to int? btw, i’m new to unity and javascript so im sorry if this is a stupid question.

Thanks in advance!

Don’t declare variables like “var RandomNumber;”. You must always supply the type, or let the type be inferred by declaring a value, such as “var randomNumber = Random.Range(0, 4);”. Also you’ll make things easier to understand if you stick to the Unity convention of using lowercase for variables, and leave uppercase for methods and classes.

Also don’t do “var WordinUse = [];”. Again, declare the type of the array, or let it be inferred from the values, like you do in the next line. Otherwise it’s an array of Object, which is harder to deal with.