|
|
Line 1: |
Line 1: |
− | Basic instructions of the three high-level programming languages offered by Unity ([http://en.wikipedia.org/wiki/JavaScript JavaScript], [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#], and [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo]) are compared here.
| |
| | | |
− | == Conventions of This Article ==
| |
− |
| |
− | 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] ===
| |
− |
| |
− | <!-- 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]
| |
− | |-
| |
− | ! 8 bit ([http://en.wikipedia.org/wiki/Byte byte]) Signed
| |
− | |
| |
− | | sbyte
| |
− | | {{n/a}}
| |
− | |-
| |
− | ! 8 bit ([http://en.wikipedia.org/wiki/Byte byte]) Unsigned
| |
− | | byte
| |
− | | byte
| |
− | | {{n/a}}
| |
− | |-
| |
− | ! 16 bit ([http://en.wikipedia.org/wiki/Short_integer short integer]) Signed
| |
− | | short
| |
− | | short
| |
− | | {{n/a}}
| |
− | |-
| |
− | ! 16 bit ([http://en.wikipedia.org/wiki/Short_integer short integer]) Unsigned
| |
− | |
| |
− | | ushort
| |
− | | {{n/a}}
| |
− | |-
| |
− | ! 32 bit Signed
| |
− | | int
| |
− | | int
| |
− | | {{n/a}}
| |
− | |-
| |
− | ! 32 bit Unsigned
| |
− | |
| |
− | | uint
| |
− | | {{n/a}}
| |
− | |-
| |
− | ! 64 bit ([http://en.wikipedia.org/wiki/Long_integer long integer]) Signed
| |
− | | long
| |
− | | long
| |
− | | {{n/a}}
| |
− | |-
| |
− | ! 64 bit [http://en.wikipedia.org/wiki/Long_integer long integer]) Unsigned
| |
− | |
| |
− | | ulong
| |
− | | {{n/a}}
| |
− | |}
| |
− |
| |
− | === [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. -->
| |
− | {| 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]
| |
− | |-
| |
− | ! [http://en.wikipedia.org/wiki/Single_precision Single Precision]
| |
− | | single
| |
− | | float
| |
− | | {{n/a}}
| |
− | |-
| |
− | ! [http://en.wikipedia.org/wiki/Double_precision Double Precision]
| |
− | | double
| |
− | | double
| |
− | | Number
| |
− | |-
| |
− | ! Arbitrarily Precise ([http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic bignum])
| |
− | | decimal
| |
− | |
| |
− | |
| |
− | |}
| |
− |
| |
− |
| |
− | === Other 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]
| |
− | |-
| |
− | ! Text [http://en.wikipedia.org/wiki/Character_(computing) Character]
| |
− | | {{n/a}}
| |
− | | char
| |
− | | {{n/a}}
| |
− | |-
| |
− | ! Text [http://en.wikipedia.org/wiki/String_(computer_science) String]
| |
− | | string
| |
− | | string
| |
− | | String
| |
− | |-
| |
− | ! [http://en.wikipedia.org/wiki/Boolean_datatype Boolean])
| |
− | | bool
| |
− | | bool
| |
− | | Boolean
| |
− | |-
| |
− | ! [http://en.wikipedia.org/wiki/Object_(computer_science) Object]/[http://en.wikipedia.org/wiki/Universal_type Universal])
| |
− | | object
| |
− | | object
| |
− | | Object
| |
− | |}
| |
− |
| |
− |
| |
− |
| |
− | == 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. -->
| |
− | {| 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]
| |
− | |-
| |
− | ! one-dimensional fixed size array
| |
− | | '''('''type''')'''
| |
− | | type'''['''size''']'''
| |
− | | type'''[]'''
| |
− | |-
| |
− | ! [http://en.wikipedia.org/wiki/Array#Multi-dimensional_array multi-dimensional] fixed size array
| |
− | |
| |
− | | type'''['''size<sub>1</sub>''', '''size<sub>2</sub>''','''...''']'''
| |
− | |
| |
− | |-
| |
− | ! one-dimensional dynamic size array
| |
− | | List
| |
− | | '''System.Collections.ArrayList'''<br/>or<br/>'''System.Collections.Generic.List<'''type'''>'''
| |
− | | Array
| |
− | |-
| |
− | ! [http://en.wikipedia.org/wiki/Array#Multi-dimensional_array multi-dimensional] dynamic size array
| |
− | |
| |
− | |
| |
− | |
| |
− | |}
| |
− |
| |
− |
| |
− | === Other 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]
| |
− | |-
| |
− | ! [http://en.wikipedia.org/wiki/Record_(computer_science) Record] Simple Composite Types
| |
− | |
| |
− | | '''struct''' name '''{'''type name''';'''...'''}'''
| |
− | |
| |
− | |-
| |
− | ! [http://en.wikipedia.org/wiki/Enumerated_type Enumeration] Simple Composite Types
| |
− | |
| |
− | '''enum''' condition''':'''<br/>
| |
− | {{keypress|tab}} '''item<sub>1</sub>'''<br/>
| |
− | {{keypress|tab}} «'''item<sub>2</sub>'''<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]
| |
− | |-
| |
− | !
| |
− | |
| |
− | |
| |
− | |
| |
− | |}
| |
− |
| |
− |
| |
− | ----
| |
− |
| |
− | [[Programming|Programming Index]]
| |