Comparison of Basic Instructions of Programming Languages
From Unify Community Wiki
(Difference between revisions)
(added "Other Non-Unity-Specific Complex Types") |
(added placeholder sections and tables for all the other factors of programming languages, per Wikipedia's equivalent page) |
||
Line 5: | Line 5: | ||
The '''bold''' is the literal code. The non-bold is interpreted by the reader. Statements in [http://en.wikipedia.org/wiki/Guillemets guillemets] (« … ») are optional. {{keypress|tab}} indicates a necessary indent. | The '''bold''' is the literal code. The non-bold is interpreted by the reader. Statements in [http://en.wikipedia.org/wiki/Guillemets guillemets] (« … ») are optional. {{keypress|tab}} indicates a necessary indent. | ||
+ | The following tables compare code differences of the Unity programming languages. See also the [[Comparison of Programming Languages]] for general information. | ||
− | |||
− | + | == Type Identifiers == | |
− | === [http://en.wikipedia.org/wiki/Integer_(computer_science) Integer] | + | === [http://en.wikipedia.org/wiki/Integer_(computer_science) Integer] === |
<!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
Line 63: | Line 63: | ||
− | === [http://en.wikipedia.org/wiki/Floating_point Floating Point] | + | === [http://en.wikipedia.org/wiki/Floating_point Floating Point] === |
<!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
Line 90: | Line 90: | ||
− | === Other | + | === Other Types === |
<!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
Line 122: | Line 122: | ||
− | === Array | + | |
+ | == Derived Types == | ||
+ | |||
+ | === [http://en.wikipedia.org/wiki/Array_data_type Array] === | ||
<!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
Line 154: | Line 157: | ||
− | === Other | + | === Other Types === |
<!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
Line 172: | Line 175: | ||
| | | | ||
'''enum''' condition''':'''<br/> | '''enum''' condition''':'''<br/> | ||
− | {{keypress|Tab}} '''item<sub>1</sub>'''<br/> | + | {{keypress|Tab}}'''item<sub>1</sub>'''<br/> |
− | {{keypress|Tab}} «'''item<sub>2</sub>'''<br/> | + | {{keypress|Tab}}«'''item<sub>2</sub>'''<br/> |
− | {{keypress|Tab}} …»<br/> | + | {{keypress|Tab}}…»<br/> |
+ | | | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | == Basic Unity-Specific Types == | ||
+ | |||
+ | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
+ | {| style="margin: 1em; margin-left: 0; background: #f9f9f9; border: 1px #aaa solid;" | ||
+ | |- | ||
+ | ! Language | ||
+ | ! [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo] | ||
+ | ! [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#] | ||
+ | ! UnityScript/[http://en.wikipedia.org/wiki/JavaScript JavaScript] | ||
+ | |- | ||
+ | ! | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | |||
+ | == Declarations == | ||
+ | |||
+ | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
+ | {| style="margin: 1em; margin-left: 0; background: #f9f9f9; border: 1px #aaa solid;" | ||
+ | |- | ||
+ | ! Language | ||
+ | ! [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo] | ||
+ | ! [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#] | ||
+ | ! UnityScript/[http://en.wikipedia.org/wiki/JavaScript JavaScript] | ||
+ | |- | ||
+ | ! | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | |||
+ | == Flow Control == | ||
+ | |||
+ | === Conditional Statements === | ||
+ | |||
+ | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
+ | {| style="margin: 1em; margin-left: 0; background: #f9f9f9; border: 1px #aaa solid;" | ||
+ | |- | ||
+ | ! Language | ||
+ | ! [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo] | ||
+ | ! [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#] | ||
+ | ! UnityScript/[http://en.wikipedia.org/wiki/JavaScript JavaScript] | ||
+ | |- | ||
+ | ! | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | |||
+ | === Loop Statements === | ||
+ | |||
+ | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
+ | {| style="margin: 1em; margin-left: 0; background: #f9f9f9; border: 1px #aaa solid;" | ||
+ | |- | ||
+ | ! Language | ||
+ | ! [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo] | ||
+ | ! [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#] | ||
+ | ! UnityScript/[http://en.wikipedia.org/wiki/JavaScript JavaScript] | ||
+ | |- | ||
+ | ! | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | |||
+ | === Exceptions === | ||
+ | |||
+ | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
+ | {| style="margin: 1em; margin-left: 0; background: #f9f9f9; border: 1px #aaa solid;" | ||
+ | |- | ||
+ | ! Language | ||
+ | ! [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo] | ||
+ | ! [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#] | ||
+ | ! UnityScript/[http://en.wikipedia.org/wiki/JavaScript JavaScript] | ||
+ | |- | ||
+ | ! | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | |||
+ | === Other Flow Control Statements === | ||
+ | |||
+ | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
+ | {| style="margin: 1em; margin-left: 0; background: #f9f9f9; border: 1px #aaa solid;" | ||
+ | |- | ||
+ | ! Language | ||
+ | ! [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo] | ||
+ | ! [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#] | ||
+ | ! UnityScript/[http://en.wikipedia.org/wiki/JavaScript JavaScript] | ||
+ | |- | ||
+ | ! | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | |||
+ | == Functions == | ||
+ | |||
+ | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
+ | {| style="margin: 1em; margin-left: 0; background: #f9f9f9; border: 1px #aaa solid;" | ||
+ | |- | ||
+ | ! Language | ||
+ | ! [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo] | ||
+ | ! [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#] | ||
+ | ! UnityScript/[http://en.wikipedia.org/wiki/JavaScript JavaScript] | ||
+ | |- | ||
+ | ! | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | |||
+ | == Type Conversions == | ||
+ | |||
+ | <!-- This table would be tons easier to read if we had tables styles with cell borders and header cell support. --> | ||
+ | {| style="margin: 1em; margin-left: 0; background: #f9f9f9; border: 1px #aaa solid;" | ||
+ | |- | ||
+ | ! Language | ||
+ | ! [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo] | ||
+ | ! [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#] | ||
+ | ! UnityScript/[http://en.wikipedia.org/wiki/JavaScript JavaScript] | ||
+ | |- | ||
+ | ! | ||
+ | | | ||
+ | | | ||
| | | | ||
|} | |} |
Revision as of 03:08, 3 August 2009
Basic instructions of the three high-level programming languages offered by Unity (JavaScript, C#, and Boo) are compared here.
Contents |
Conventions of This Article
The bold is the literal code. The non-bold is interpreted by the reader. Statements in guillemets (« … ») are optional. tab indicates a necessary indent.
The following tables compare code differences of the Unity programming languages. See also the Comparison of Programming Languages for general information.
Type Identifiers
Integer
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
8 bit (byte) Signed | sbyte | N/A | |
8 bit (byte) Unsigned | byte | N/A | |
16 bit (short integer) Signed | short | short | N/A |
16 bit (short integer) Unsigned | ushort | N/A | |
32 bit Signed | int | int | N/A |
32 bit Unsigned | uint | N/A | |
64 bit (long integer) Signed | long | long | N/A |
64 bit long integer) Unsigned | ulong | N/A |
Floating Point
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
Single Precision | single | float | N/A |
Double Precision | double | double | Number |
Arbitrarily Precise (bignum) | decimal |
Other Types
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
Text Character | N/A | char | N/A |
Text String | string | string | String |
Boolean) | bool | bool | Boolean |
Object/Universal) | object | object | Object |
Derived Types
Array
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
one-dimensional fixed size array | (type) | type[size] | type[] |
multi-dimensional fixed size array | type[size1, size2,...] | ||
one-dimensional dynamic size array | List | System.Collections.ArrayList or System.Collections.Generic.List<type> |
Array |
multi-dimensional dynamic size array |
Other Types
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
Record Simple Composite Types | struct name {type name;...} | ||
Enumeration Simple Composite Types |
enum condition: |
Basic Unity-Specific Types
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
Declarations
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
Flow Control
Conditional Statements
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
Loop Statements
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
Exceptions
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
Other Flow Control Statements
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
Functions
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|
Type Conversions
Language | Boo | C# | UnityScript/JavaScript |
---|---|---|---|