Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Edit:</strong> Reading more about <a href="http://unity3d.com/" rel="noreferrer">Unity</a>, they have created a really <em>custom</em> implementation of JavaScript<sup>(1)</sup> for their scripting engine, which is <em>compiled</em> and it has a lot of <em>strongly typing</em> features, it looks like ActionScript/ES4, but it isn't, the language is called <a href="http://code.google.com/p/unityscript/" rel="noreferrer">UnityScript</a>.</p> <p>The colon is used by this implementation to denote the <em>type</em> of an identifier, e.g.:</p> <pre><code>class Person{ var name : String; function Person(n : String){ name = n; } function kiss(p : Person){ Debug.Log(name + " kissed " + p.name + "!"); } } </code></pre> <p>See also:</p> <ul> <li><a href="http://unity3d.com/support/documentation/ScriptReference/index.html" rel="noreferrer">UnityScript Reference</a></li> <li><a href="http://www.unifycommunity.com/wiki/index.php?title=Head_First_into_Unity_with_JavaScript" rel="noreferrer">Head First into Unity with JavaScript</a></li> <li><a href="http://unity3d.com/support/documentation/ScriptReference/index.html" rel="noreferrer">Scripting Overview</a></li> <li><a href="http://answers.unity3d.com/questions/" rel="noreferrer">Unity Answers</a></li> </ul> <hr> <p>The code you posted is not valid ECMAScript 3, (which is the most widely implemented standard), that will simply give you a <code>SyntaxError</code>.</p> <p>The colon symbol in JavaScript has only a few usages:</p> <ol> <li><p>The <a href="http://mdn.beonex.com/en/Core_JavaScript_1.5_Guide/Literals#Object_Literals" rel="noreferrer">object literal</a> syntax:</p> <pre><code>var obj = { foo: 'bar' }; </code></pre></li> <li><p>The <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Operators/Special_Operators/Conditional_Operator" rel="noreferrer">conditional operator</a>:</p> <pre><code>var test = condition ? 'foo' : 'bar'; </code></pre></li> <li><p><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Statements#label_Statement" rel="noreferrer">Labeled statements</a>:</p> <pre><code>loop1: while (true) { while (true) { break loop1; // stop outer loop } } </code></pre></li> <li><p>Case and default clauses of the <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/switch" rel="noreferrer">switch statement</a>:</p> <pre><code>switch (value) { case "foo": //.. break; default: //.. break; } </code></pre></li> <li><p>It can appear on <a href="https://developer.mozilla.org/en/core_javascript_1.5_guide/regular_expressions" rel="noreferrer">RegExp literals</a>:</p> <pre><code>var re = /(?:)/; // non-capturing group... </code></pre></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload