Where can I find a list of variable types for use in Javascript?

Where can I find a list of variable types so I can type ("var mynum:float;") all my variables?

You generally don't need to do that; type inference takes care of it for you.

var foo = 5.0;         // This is typed as a float
var foo = 5;           // This is typed as an int
var foo = Vector3.zero // This is typed as a Vector3

Pretty much the only way to get an untyped variable is to do this:

var foo;

If you're declaring a variable with just the type and default value ("`var foo : float;`"), then this has a list of some of the types.

The most common built in are:

  • boolean (true/false)
  • int (numbers without decimals)
  • float (numbers with decimals)
  • String (text)

Obviously there are more, but these are the basic ones everyone should be familiar with...

Then there are a ton of types in the mono framework. I am not really a mono guy myself, I look things up in MSDN for .NET docs.

Finally Unity expose several types that you find in the scripting reference, stuff like Vector3, Quaternion, MonoBehaviour, Time...

  • This all comes from someone who doesn't use Javascript on a regular basis so I'd love to see JS people chip in with their thoughts and point good Dave here to better resources.

I found this page that lists types used in UScript I have a case where float type fails a comparison, so I was looking for single or double... seems double is the only one available.