What is Javascript dynamic typing and type inference on initialization?

Hey Unitarians! (Specifically Android Javascript programmers…)

I’m in a bit of a spot of trouble. I made a game with a ton of javascripts that were initially going to be developed for desktop. I changed my mind and switched to Android. I got a bazillion compile errors, and after much google hunting, Unity told me what I did wrong: http://docs.unity3d.com/Manual/android-GettingStarted.html.
At near the end of this URL, it says,

For performance reasons, dynamic typing in JavaScript is always turned off in Unity Android, as if #pragma strict were applied automatically to all scripts. This is important to know if you start with a project originally developed for the desktop platforms since you may find you get unexpected compile errors when switching to Android; dynamic typing is the first thing to investigate. These errors are usually easy to fix if you make sure all variables are explicitly typed or use type inference on initialization.

So I know that I should have made it in C Sharp, like most of my other Android projects. However, I have no idea how to convert Javascripts to C Sharp and I imagine that even if I did it would take a lot of time that I don’t have.

They show two solutions at the end of their paragraph. They say that I can “make sure all variables are explicitly typed” I imagine this would take a lot of unnessesary time, and either way I’m not 100% sure what they mean on that.
They also say something called “use type inference on initialization”. As my last resort, I’m interested in this. Can anyone tell me what it is and what to do? Or if you could clear up dynamic typing in general as well, that’d be great since I believe I only have a on-the-surface idea of what’s happening here.

Your awesome Indie developer,
Aman Jha

It’s telling you to tell Unity what Type your variables are as you declare them, rather than letting it work that out based on the data that’s put in.

var myFloat : float = 0.0;

rather than

var myFloat = 0.0;

My answer disappeared again… I’ll re-write it.

Unity is telling you to tell it what Type your variables are as you declare them rather than letting it work that out based on the data that’s put in.


var myFloat : float = 0.0;


var myFloat = 0.0;

Rather than

var myFloat;
myFloat = 0.0;