Content deleted Content added
SilverLocust (talk | contribs) substituting most {{code| }} calls with {{subst:codenowiki| }} to go under the expensive parser limit Tag: nowiki added |
SilverLocust (talk | contribs) removed nowiki tags where unnecessary |
||
Line 34:
|-
| [[Ada (programming language)|Ada]]<ref name="Ada_RM_2012">Ada Reference Manual – Language and Standard Libraries; ISO/IEC 8652:201x (E), {{cite web |url=http://www.ada-auth.org/standards/12rm/RM-Final.pdf |title=Reference Manual |access-date=2013-07-19 |url-status=dead |archive-url=https://web.archive.org/web/20110427190723/http://www.ada-auth.org/standards/12rm/RM-Final.pdf |archive-date=2011-04-27 }}</ref>
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code>range 0 .. 2**Integer'<wbr/>Size - 1</code>{{ref|Ada_range|[j]}} or <code>mod Integer'<wbr/>Size</code>{{ref|Ada_mod|[k]}}
| {{n/a}}
|-
| rowspan=2| [[ALGOL 68]] (variable-width)
| rowspan=2| <code
| rowspan=2 {{n/a}}
| rowspan=2| <code
| rowspan=2 {{n/a}}
| rowspan=2| <code
| rowspan=2 {{n/a}}
| rowspan=2| <code
| rowspan=2 {{n/a}}
| <code
| {{n/a}}
| rowspan=2| <code
|-
| colspan=2 align=center|<code
|-
| [[C (programming language)|C]] ([[C99]] fixed-width)
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=5 {{n/a}}
|-
Line 77:
|-
| [[C (programming language)|C]] ([[C99]] variable-width)
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
| rowspan=2| <code
|-
| [[C++]] ([[C++11]] variable-width)
|-
| [[Objective-C]] ([[Cocoa (API)|Cocoa]])
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
|-
| [[C Sharp (programming language)|C#]]
| <code
| <code
| rowspan=2| <code
| <code
| rowspan=2| <code
| <code
| rowspan=2| <code
| <code
| <code
| <code
| <code>System.Numerics.<wbr/>BigInteger</code><br/>(.NET 4.0)
|-
| [[Java (programming language)|Java]]
| <code
| {{n/a}}
| <code
| {{n/a}}
| {{n/a}}
Line 126:
|-
| [[Go (programming language)|Go]]
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
|-
| [[Rust (programming language)|Rust]]
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| {{n/a}}
|-
| [[Swift (programming language)|Swift]]
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
|-
| [[D (programming language)|D]]
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| {{n/a}}
| {{n/a}}
| <code
|-
| [[Common Lisp]]<ref name="HyperSpec">{{cite web|url=http://www.lispworks.com/documentation/HyperSpec/Front/index.htm|title=Common Lisp HyperSpec (TM)|work=lispworks.com|access-date=30 January 2017}}</ref>
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
|
|
| <code
|-
| [[Scheme (programming language)|Scheme]]
Line 213:
|
|
| <code
|-
| [[Pascal (programming language)|Pascal]] ([[Free Pascal|FPC]])
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| {{n/a}}
|-
| [[Visual Basic (classic)|Visual Basic]]
| {{n/a}}
| rowspan=2|<code
| <code
| {{n/a}}
| <code
| {{n/a}}
| colspan=2 {{n/a}}
Line 240:
|-
| [[Visual Basic .NET]]
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code>System.Numerics<wbr/>.BigInteger</code><br/>(.NET 4.0)
|-
| [[FreeBasic]]
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| {{n/a}}
|-
Line 267:
| colspan=2 {{n/a}}
| colspan=2 {{n/a}}
| <code
| {{n/a}}
| <code
|-
| [[Python (programming language)|Python]] 3.x
Line 277:
| colspan=2 {{n/a}}
| colspan=2 {{n/a}}
| <code
|-
| [[S-Lang (programming language)|S-Lang]]
Line 303:
| colspan=2 {{n/a}}
| colspan=2 {{n/a}}
| <code
| {{n/a}}
| <code
| {{n/a}}
| colspan=2 {{n/a}}
Line 316:
| colspan=2 {{n/a}}{{ref|scalars|[d]}}
| colspan=2 {{n/a}}{{ref|scalars|[d]}}
| <code
|-
| [[Raku (programming language)|Raku]]
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| colspan=2 {{n/a}}
|-
Line 335:
| colspan=2 {{n/a}}
| colspan=2 {{n/a}}
| <code
| {{n/a}}
| <code
|-
| [[Erlang (programming language)|Erlang]]{{ref|Erlang_int|[n]}}
Line 344:
| colspan=2 {{n/a}}
| colspan=2 {{n/a}}
| <code
| {{n/a}}
| <code
|-
| [[Scala (programming language)|Scala]]
| <code
| {{n/a}}
| <code
| <code
| <code
| {{n/a}}
| <code
| {{n/a}}
| {{n/a}}
| {{n/a}}
| <code
|-
| [[Seed7]]
Line 368:
| {{n/a}}
| {{n/a}}
| <code
| {{n/a}}
| {{n/a}}
| {{n/a}}
| <code
|-
| [[Smalltalk]]
Line 379:
| colspan=2 {{n/a}}
| colspan=2 {{n/a}}
| <code
| {{n/a}}
| <code
|-
| [[Windows PowerShell]]
Line 394:
| colspan=2 {{n/a}}
| colspan=2 {{n/a}}
| <code
| {{n/a}}
| rowspan=2| <code
| {{n/a}}
| <code
|
| <code
|-
| [[F Sharp (programming language)|F#]]
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
|-
| [[Standard ML]]
| {{n/a}}
| <code
| colspan=2 {{n/a}}
| <code
| <code
| <code
| <code
| <code
| <code
| <code
|-
| [[Haskell]] ([[Glasgow Haskell Compiler|GHC]])
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
|-
| [[Eiffel (programming language)|Eiffel]]
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| {{n/a}}
|-
| [[COBOL]]{{ref|Cobol|[h]}}
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| <code
| {{n/a}}
| {{n/a}}
Line 471:
| colspan=2 {{n/a}}
| colspan=2 {{n/a}}
| <code
|-
| [[Wolfram Language]]
Line 479:
| colspan=2 {{n/a}}
| colspan=2 {{n/a}}
| <code
|}
* {{note|a68|a}} The ''standard'' constants <code
* {{note|Java char|b}} Commonly used for characters.
* {{note|CInt|c}} The ALGOL 68, C and C++ languages do not specify the exact width of the integer types <code
* {{note|scalars|d}} Perl 5 does not have distinct types. Integers, floating point numbers, strings, etc. are all considered "scalars".
* {{note|PHP bignum|e}} PHP has two arbitrary-precision libraries. The BCMath library just uses strings as datatype. The GMP library uses an internal "resource" type.
* {{note|Kinds|f}} The value of <code
* {{note|a68g|g}} [[ALGOL 68]]G's runtime option <code
* {{note|Cobol|h}} [[COBOL]] allows the specification of a required precision and will automatically select an available type capable of representing the specified precision. "<code
* {{note|Smalltalk|i}} [[Smalltalk]] automatically chooses an appropriate representation for integral numbers. Typically, two representations are present, one for integers fitting the native word size minus any tag bit ({{mono|SmallInteger}}) and one supporting arbitrary sized integers ({{mono|LargeInteger}}). Arithmetic operations support polymorphic arguments and return the result in the most appropriate compact representation.
* {{note|Ada_range|j}} [[Ada (programming language)|Ada]] range types are checked for boundary violations at run-time (as well as at compile-time for static expressions). Run-time boundary violations raise a "constraint error" exception. Ranges are not restricted to powers of two. Commonly predefined Integer subtypes are: Positive (<code>range 1 .. Integer'Last</code>) and Natural (<code>range 0 .. Integer'Last</code>). <code
* {{note|Ada mod|k}} [[Ada (programming language)|Ada]] modulo types implement modulo arithmetic in all operations, i.e. no range violations are possible. Modulos are not restricted to powers of two.
* {{note|Scala char|l}} Commonly used for characters like Java's char.
* {{note|PHP 32/64 bit long|m}} <code
* {{note|Erlang int|n}} [[Erlang (programming language)|Erlang]] is dynamically typed. The type identifiers are usually used to specify types of record fields and the argument and return types of functions.<ref>{{cite web|url=http://www.erlang.org/doc/reference_manual/typespec.html|title=Erlang {{--}} Types and Function Specifications|work=erlang.org|access-date=30 January 2017}}</ref>
* {{note|Erlang arb|o}} When it exceeds one word.<ref>{{cite web|url=http://www.erlang.org/doc/efficiency_guide/advanced.html|title=Erlang {{--}} Advanced|work=erlang.org|access-date=30 January 2017}}</ref>
Line 507:
|-
| [[Ada (programming language)|Ada]]<ref name="Ada_RM_2012" />
| <code
| <code
| {{n/a}}
|-
| [[ALGOL 68]]
| <code
| <code
| <code
|-
| [[C (programming language)|C]]
| rowspan=3| <code
| rowspan=5| <code
| rowspan=3| <code
|-
| [[C++]] (STL)
|-
| [[Objective-C]] ([[Cocoa (API)|Cocoa]])
| <code
|-
| [[C Sharp (programming language)|C#]]
| rowspan=2| <code
| rowspan=4 {{n/a}}
|-
Line 533:
|-
| [[Go (programming language)|Go]]
| <code
| <code
|-
| [[Rust (programming language)|Rust]]
| <code
| <code
|-
| [[Swift (programming language)|Swift]]
| <code
| <code
| <code
| <code
|-
| [[D (programming language)|D]]
| <code
| <code
|
| <code
|-
| [[Common Lisp]]
| <code
| <code
| <code
|-
| [[Scheme (programming language)|Scheme]]
Line 568:
|-
| [[Pascal (programming language)|Pascal]] ([[Free Pascal|FPC]])
| <code
| <code
|
| <code
|-
| [[Visual Basic (classic)|Visual Basic]]
| rowspan=3| <code
| rowspan=3| <code
| rowspan=3 {{n/a}}
|-
Line 584:
| [[Python (programming language)|Python]]
| rowspan=2 {{n/a}}
| <code
|
|-
| [[JavaScript]]
| <code
| {{n/a}}
|-
Line 602:
| [[PHP]]
|
| <code
|
|-
Line 611:
|-
| [[Raku (programming language)|Raku]]
| <code
| <code
|
| <code
|-
| [[Ruby (programming language)|Ruby]]
| {{n/a}}
| <code
| rowspan=4 {{n/a}}
|-
| [[Scala (programming language)|Scala]]
| <code
| <code
|-
| [[Seed7]]
| {{n/a}}
| <code
|-
| [[Smalltalk]]
| <code
| <code
|-
| [[Windows PowerShell]]
Line 640:
| [[OCaml]]
| {{n/a}}
| rowspan=2| <code
| rowspan=3 {{n/a}}
|-
| [[F Sharp (programming language)|F#]]
| <code
|-
| [[Standard ML]]
| {{n/a}}
|
| <code
|-
| [[Haskell]] ([[Glasgow Haskell Compiler|GHC]])
| <code
| <code
|
|-
| [[Eiffel (programming language)|Eiffel]]
| <code
| <code
|
|-
| [[COBOL]]
| <code
| <code
| <code
|-
| [[Mathematica]]
Line 670:
| {{n/a}}
|
| <code
|}
* {{note|a68_real|a}} The ''standard'' constants <code
* {{note|lax floats|b}} declarations of single precision often are not honored
* {{note|real kinds|c}} The value of <code
* {{note|a68g-real|d}} [[ALGOL 68]]G's runtime option <code
* {{note|Cobol-ieee|e}} These [[IEEE]] floating-point types will be introduced in the next COBOL standard.
* {{note|C-long-double|f}} Same size as <code
* {{note|Swift-long-double|g}} Swift supports 80-bit [[Extended precision#Language support|extended precision]] floating point type, equivalent to <code
=== [[Complex number]]s ===
Line 691:
| [[Ada (programming language)|Ada]]<ref name="Ada_RM_2012" />
| {{n/a}}
| <code
| <code
| <code
|-
| [[ALGOL 68]]
| {{n/a}}
| <code
| <code
| <code
|-
| [[C (programming language)|C]] ([[C99]])<ref>{{cite web|url=https://www.gnu.org/software/libc/manual/html_node/Complex-Numbers.html#Complex-Numbers|title=The GNU C Library: Complex Numbers|work=gnu.org|access-date=30 January 2017}}</ref>
| {{n/a}}
| <code
| <code
| rowspan=7 {{n/a}}
|-
Line 715:
| {{n/a}}
| {{n/a}}
| <code
|-
| [[Java (programming language)|Java]]
Line 724:
| [[Go (programming language)|Go]]
| {{n/a}}
| <code
| <code
|-
| [[D (programming language)|D]]
| {{n/a}}
| <code
| <code
|-
| [[Objective-C]]
Line 762:
| {{n/a}}
| {{n/a}}
| <code
|-
| [[Perl]]
|
|
| <code
|
|-
| [[Raku (programming language)|Raku]]
|
| <code
| <code
| <code
|-
| [[Python (programming language)|Python]]
|
|
| <code
| rowspan=15 {{n/a}}
|-
Line 797:
|-
| [[Ruby (programming language)|Ruby]]
| <code
| {{n/a}}
| <code
|-
| [[Scala (programming language)|Scala]]
Line 809:
| {{n/a}}
| {{n/a}}
| <code
|-
| [[Smalltalk]]
| <code
| <code
| <code
|-
| [[Windows PowerShell]]
Line 824:
| {{n/a}}
| {{n/a}}
| <code
|-
| [[F Sharp (programming language)|F#]]
|
|
| <code
|-
| [[Standard ML]]
Line 852:
|-
| [[Mathematica]]
| <code
| {{n/a}}
| {{n/a}}
| <code
|}
* {{note|complex kinds|a}} The value of <code
* {{note|generic type|b}} Generic type which can be instantiated with any base floating point type.
Line 873:
|-
| [[Ada (programming language)|Ada]]<ref name="Ada_RM_2012" />
| <code
| <code
| <code
| <code>(''item<sub>1</sub>'', ''item<sub>2</sub>'', ''...'')</code>
| <code
|-
| [[ALGOL 68]]
| <code
| <code
| <code
| {{n/a}} - [http://rosettacode.org/wiki/Enumerations#ALGOL_68 User defined]
| {{n/a}}
|-
| [[C (programming language)|C]] ([[C99]])
| rowspan=2| <code
| {{n/a}}
| rowspan=2| <code
| rowspan=3| <code>enum ''«name»'' { ''item<sub>1</sub>'', ''item<sub>2</sub>'', ''...'' };</code>
| rowspan=2| <code>[[void type|void]] [[pointer (computer programming)|*]]</code>
|-
| [[C++]] (STL)
| [[C++ string handling|<code
|-
| [[Objective-C]]
| <code
| <code
| <code
| <code
|-
| [[C Sharp (programming language)|C#]]
| rowspan=2| <code
| <code
| <code
| <code>enum ''name'' { ''item<sub>1</sub>''« = ''value''», ''item<sub>2</sub>''« = ''value''», ''...'' }</code>
| object
|-
| [[Java (programming language)|Java]]
| <code
| <code
| <code>enum ''name'' { ''item<sub>1</sub>'', ''item<sub>2</sub>'', ''...'' }</code>
| <code
|-
| [[Go (programming language)|Go]]
| <code
| <code
| <code
| <code>const (<br/>{{Spaces|3}}''item{{sub|1}}'' = ''iota''<br/>{{Spaces|3}}''item{{sub|2}}''<br/>{{Spaces|3}}''...''<br/>)</code>
| <code>interface{}</code>
|-
| [[Rust (programming language)|Rust]]
| <code
| <code
| <code
| <code>enum ''name'' { ''item{{sub|1}}''« = ''value''», ''item{{sub|2}}''« = ''value''», ''...'' }</code>
| <code
|-
| [[Swift (programming language)|Swift]]
| <code
| <code
| <code
| <code>enum ''name'' { case ''item<sub>1</sub>'', ''item<sub>2</sub>'', ''...'' }</code>
| <code
|-
| [[D (programming language)|D]]
| <code
| <code
| <code
| <code>enum ''name'' { ''item<sub>1</sub>'', ''item<sub>2</sub>'', ''...'' }</code>
| <code
|-
| [[Common Lisp]]
| <code
| <code
| <code
| <code>(member ''item<sub>1</sub>'' ''item<sub>2</sub>'' ''...'')</code>
| <code
|-
| [[Scheme (programming language)|Scheme]]
Line 965:
|-
| Pascal (ISO)
| rowspan=2| <code
| {{n/a}}
| rowspan=2| <code
| rowspan=2| <code>( ''item<sub>1</sub>'', ''item<sub>2</sub>'', ''...'' )</code>
| {{n/a}}
|-
| [[Object Pascal]] (Delphi)
| <code
| <code
|-
| [[Visual Basic (classic)|Visual Basic]]
| {{n/a}}
| rowspan=3| <code
| rowspan=3| <code
| rowspan=3| <code>Enum ''name''<br/>{{Spaces|3}}''item{{sub|1}}'' «= ''value''»<br/>{{Spaces|3}}''item{{sub|2}}'' «= ''value»<br/>{{Spaces|3}}...''<br/>End Enum</code>
| <code><nowiki>[[Variant type|Variant]]</nowiki></code>
|-
| [[Visual Basic .NET]]
| <code
| <code
|-
| [[Xojo]]
| {{n/a}}
| <code
|-
| [[Python (programming language)|Python]]
| {{n/a}}{{ref|string as char|[d]}}
| <code
| <code
| <code>from enum import Enum<br/>class Name(Enum):<br/>{{Spaces|3}}''item{{sub|1}}'' = ''value''<br/>{{Spaces|3}}''item{{sub|2}}'' = ''value''<br/>{{Spaces|3}}''...''</code>
| <code
|-
| [[JavaScript]]
| {{n/a}}{{ref|string as char|[d]}}
| <code
| <code
|
| <code
|-
| [[S-Lang (programming language)|S-Lang]]
Line 1,016:
| <code>LOGICAL(KIND = n)</code>{{ref|logical kinds|[f]}}
|
| <code
|-
| [[PHP]]
| {{n/a}}{{ref|string as char|[d]}}
| <code
| <code
|
| (type declaration omitted)
Line 1,030:
|
|
| <code
|-
| [[Raku (programming language)|Raku]]
| <code
| <code
| <code
| <code>enum ''name<item<sub>1</sub> item<sub>2</sub> ...>''</code><br/><code>enum ''name <<:item<sub>1</sub>(value) :item<sub>2</sub>(value) ..>>''</code>
| <code
|-
| [[Ruby (programming language)|Ruby]]
| {{n/a}}{{ref|string as char|[d]}}
| <code
| <code
|
| <code
|-
| [[Scala (programming language)|Scala]]
| <code
| <code
| <code
| <code>object ''name'' extends Enumeration {<br/>{{Spaces|3}}''val item{{sub|1}}, item{{sub|2}}, ... = Value''<br/>}</code>
| <code
|-
| [[Seed7]]
| <code
| <code
| <code
| <code>const type'': name'' is new enum<br/>{{Spaces|3}}''item{{sub|1}},''<br/>{{Spaces|3}}''item{{sub|2}},''<br/>{{Spaces|3}}''...''<br/>end enum;</code>
|
Line 1,068:
|-
| [[OCaml]]
| rowspan=3| <code
| rowspan=3| <code
| rowspan=3| <code
| {{n/a}}{{ref|enum|[e]}}
| {{n/a}}
Line 1,076:
| [[F Sharp (programming language)|F#]]
| <code>type ''name'' = ''item<sub>1</sub>'' = ''value'' {{pipe}}''item<sub>2</sub>'' = ''value'' {{pipe}} ''...''</code>
| <code
|-
| [[Standard ML]]
Line 1,083:
|-
| [[Haskell]] ([[Glasgow Haskell Compiler|GHC]])
| <code
| <code
| <code
| {{n/a}}{{ref|enum|[e]}}
| {{n/a}}
|-
| [[Eiffel (programming language)|Eiffel]]
| <code
| <code
| <code
| {{n/a}}
| <code
|-
| [[COBOL]]
| <code
| <code>''PIC X(''string length'')''</code> or <code>PIC X«X...»</code>
| <code>''PIC 1«(''number of digits'')»''</code> or <code>PIC 1«1...»</code>
| {{n/a}}
| <code
|-
| [[Mathematica]]
| {{n/a}}{{ref|string as char|[d]}}
| <code
|
|
Line 1,113:
* {{note|string|a}} specifically, strings of arbitrary length and automatically managed.
* {{note|int bool|b}} This language represents a boolean as an integer where false is represented as a value of zero and true by a non-zero value.
* {{note|Ruby's bool|c}} All values evaluate to either true or false. Everything in ''<code
* {{note|string as char|d}}This language does not have a separate character type. Characters are represented as strings of length 1.
* {{note|enum|e}} Enumerations in this language are algebraic types with only nullary constructors
* {{note|logical kinds|f}} The value of ''<code
== Derived types ==
Line 1,203:
|- valign="top"
| [[Common Lisp]]
| <code
| <code
| <code
| <code
|- valign="top"
| [[Scheme (programming language)|Scheme]]
Line 1,339:
|}
* {{note|C's array|a}}In most expressions (except the <code>[[sizeof]]</code> and <code
* {{note|Java's array|b}} The C-like <code>''type'' x[]</code> works in Java, however <code>''type''[] x</code> is the preferred form of array declaration.
* {{note|subrange|c}} Subranges are used to define the bounds of the array.
* {{note|JavaScript's array|d}} JavaScript's array are a special kind of object. <!-- explain array(size) thing -->
* {{note|COBOL DEPENDING ON clause|e}} The <code
=== Other types ===
Line 1,419:
|-
| [[Common Lisp]]
| <code
| rowspan=3| <code>(cons ''val{{sub|1}} val{{sub|2}}'')</code>{{ref|pair only|[c]}}
|
Line 1,529:
* {{note|just classes|a}} Only classes are supported.
* {{note|C++'s struct|b}} <code
* {{note|pair only|c}} pair only
* {{note|Perl's records|d}} Although Perl doesn't have records, because Perl's type system allows different data types to be in an array, "hashes" (associative arrays) that don't have a variable index would effectively be the same as records.
Line 1,619:
| rowspan=3| See notes to left.
Constants use the same syntax, and:
* use <code
* have a restriction to only certain primitive types<br/><code>Const ''name<sub>1</sub>'' «As ''type''» = ''value'', ''name<sub>2</sub>'' «As ''type»'' = ''value, ...''</code>
|
Line 1,626:
| The variable declaration syntax of VB.NET is unusually difficult to precisely describe.
Given that there exist the identifier suffixes ("modifiers"):
* <code
* <code
* <code
and that
* a <code
* a <code
* a <code
** <code>''identifier'' As ''object_creation_expression''</code>'' (object initializer declarator)'',
** <code>''modified_identifier'' «As ''non_array_type''«''array_rank_specifier''»»« = ''initial_value»''</code> ''(single declarator)'', or
Line 1,638:
valid declaration statements are of the form
{{In5}}<code>Dim ''declarator_list''</code>,
where, for the purpose of semantic analysis, to convert the <code
* The <code
* The <code>As New ''type...''</code> of each ''object initializer declarator'' is replaced with <code>As ''type'' = New ''type...''</code>
and for which, for each <code
* a <code
* if an <code
** an <code
* an <code
** if a <code
*** <code
** and that otherwise,
*** either <code
*** <code
* its <code
* its <code
* if an <code
** either <code
** <code
If <code
<code><nowiki>name {{=}} initial_value</nowiki></code>
| <code>Imports ''synonym'' = ''type''</code>
Line 1,752:
* {{note|variable types|b}}Types are just regular objects, so you can just assign them.
* {{note|Perl's my keyword|c}} In Perl, the "my" keyword scopes the variable into the block.
* {{note|ML ref|d}} Technically, this does not declare ''name'' to be a mutable variable—in ML, all names can only be bound once; rather, it declares ''name'' to point to a "reference" data structure, which is a simple mutable cell. The data structure can then be read and written to using the <code
* {{note|Ada declaration|e}} If no initial value is given, an invalid value is automatically assigned (which will trigger a run-time exception if it used before a valid value has been assigned). While this behaviour can be suppressed it is recommended in the interest of predictability. If no invalid value can be found for a type (for example in case of an unconstraint integer type), a valid, yet predictable value is chosen instead.
* {{note|Rust declaration|f}} In Rust, if no initial value is given to a <code
== [[Control flow]] ==
Line 1,803:
|- valign="top"
| [[C (programming language)|C]] ([[C99]])
| rowspan=7| <code>if (''condition'') ''instructions''<br/>«else ''instructions''»</code><br/><code
| rowspan=7| <code>if (''condition'') ''instructions''<br/>else if (''condition'') ''instructions''<br/>''...''<br/>«else ''instructions»''</code><br/>or<br/><code>if (''condition'') ''instructions''<br/>else { if (''condition'') ''instructions'' }</code>
| rowspan=7| <code>switch (''variable'') { {{indent|2}}case ''case1'': ''instructions'' «; break;»{{indent|2}}''...''{{indent|2}}«default: ''instructions''»<br/>}</code>
Line 1,822:
| [[C Sharp (programming language)|C#]]
| <code>if (''condition'') ''instructions''<br/>«else ''instructions''»</code>
<code
| <code>if (''condition'') ''instructions''<br/>else if (''condition'') ''instructions''<br/>''...''<br/>«else ''instructions''»</code>
| <code>switch (''variable'')<br/>{ {{indent|2}}case ''case{{sub|1}}'':{{indent|4}}''instructions''{{indent|4}}«''break_or_jump_statement''»{{indent|2}}''...''{{indent|2}}«default:{{indent|4}}''instructions''{{indent|4}}''break_or_jump_statement''»<br/>}</code>
All non-empty cases must end with a <code
The <code
| <code>''condition'' [[?:|?]] ''valueIfTrue'' [[?:|:]] ''valueIfFalse''</code>
|- valign="top"
Line 1,901:
|- valign="top"
| [[Visual Basic (classic)|Visual Basic]]
| rowspan=3| <code>If ''condition'' Then{{indent|2}}''instructions''<br/>«Else{{indent|2}}''instructions''»<br/>End If</code><br/>Single-line, when <code
| rowspan=3| <code>If ''condition'' Then{{indent|2}}''instructions''<br/>ElseIf ''condition'' Then{{indent|2}}''instructions''<br/>''...''<br/>«Else{{indent|2}}''instructions''»<br/>End If</code><br/>Single-line:<br/>See note about C-like languages; the <code
| rowspan=3| <code>Select« Case» ''variable''{{indent|2}}Case ''case_pattern{{sub|1}}''{{indent|4}}''instructions''{{indent|2}}''...''{{indent|2}}«Case Else{{indent|4}}''instructions''»<br/>End Select</code>
| <code>[[IIf]](''condition'', ''valueIfTrue'', ''valueIfFalse'')</code>
Line 1,992:
* {{note|pascal semicolon|c}} In languages of the Pascal family, the semicolon is not part of the statement. It is a separator between statements, not a terminator.
* {{note|COBOL END-IF|d}} <code>END-IF</code> may be used instead of the period at the end.
* {{note|Rust match expression|e}} In Rust, the comma (<code
=== [[Control flow#Loops|Loop statements]] ===
Line 2,023:
|-
| [[C (programming language)|C]] ([[C99]])
| rowspan=9| <code
| rowspan=9| <code>do ''instructions'' while (''condition'');</code>
| rowspan=5| <code>for (''«type» i'' = ''first''; ''i'' <= ''last''; ''i''++) ''instructions''</code>
Line 2,130:
|-
| [[Visual Basic (classic)|Visual Basic]]
| rowspan=2| <code>Do While ''condition''{{indent|2}}''instructions''<br/>Loop</code><br/>or<br/><code>Do Until ''notcondition''{{indent|2}}''instructions''<br/>Loop</code><br/>or<br/><code>While ''condition''{{indent|2}}''instructions''<br/>Wend</code> (Visual Basic .NET uses <code
| rowspan=2| <code>Do{{indent|2}}''instructions''<br/>Loop While ''condition''</code><br/>or<br/><code>Do{{indent|2}}''instructions''<br/>Loop Until ''notcondition''</code>
| <code
<code>For ''i'' = ''first'' To ''last'' «Step ''1»{{indent|2}}instructions''<br/>Next i</code>
| <code>For Each ''item'' In ''set''{{indent|2}}''instructions''<br/>Next ''item''</code>
Line 2,395:
|}
* {{note|common lisp restarts|a}} Common Lisp allows <code
* {{note|Ada uncaught exceptions|b}} Uncaught exceptions are propagated to the innermost dynamically enclosing execution. Exceptions are not propagated across tasks (unless these tasks are currently synchronised in a rendezvous).
Line 2,418:
| <code>''value'' exit;</code> ...
| <code>do ''statements;'' skip exit; ''label: statements'' od</code>
| <code
| <code>go to ''label; ...''<br/>goto ''label; ...<br/>label; ...''</code>
| <code>yield(value)</code>
Line 2,520:
|-
| [[Visual Basic (classic)|Visual Basic]]
| rowspan=3| <code>Exit ''block''</code>Alternatively, for methods,<br/><code
| {{n/a}}
| rowspan=3| <code>''label'':</code>
Line 2,554:
| <code>EXIT</code>
| <code>CYCLE</code>
| <code
| <code>GOTO ''label''</code>
| {{n/a}}
Line 2,644:
| Same as above; alternatively, if simple enough to be an expression:
<code>[[void type|void]] foo(''«parameters»'') => ''expression'';</code>
| <code>static void Main(«string[] args») method_body</code><br/>May instead return <code
|- valign="top"
| [[JavaScript]]
Line 2,689:
| [[Visual Basic .NET]]
| rowspan=2| Same as above; alternatively:
<code>Function Foo«(''parameters'')»« As ''type»''{{indent|2}}''instructions''{{indent|2}}Return ''value''<br/>End Function</code><br/>The <code
| rowspan=2| <code>Sub Main(««ByVal »args() As String»){{indent|2}}''instructions''<br/>End Sub</code>or<br/><code>Function Main(««ByVal »args() As String») As Integer{{indent|2}}''instructions''<br/>End Function</code>
|- valign="top"
Line 2,814:
|}
* {{note|forward declaration|a}} Pascal requires "<code
* {{note|root class and feature|b}} Eiffel allows the specification of an application's root class and feature.
* {{note|Fortran arguments|c}} In Fortran, function/subroutine parameters are called arguments (since <code
* {{note|COBOL calling programs|d}} Instead of using <code
== [[Type conversion]]s{{anchor|Data conversions}} ==
Line 2,840:
| colspan=5 align=center| With prior declarations and association of: <code>string ''buf := "12345678.9012e34 ";'' file ''proxy; associate(proxy, buf);''</code>
|-
| <code
| <code
| <code
| <code
| <code
|-
| <code
| <code
| <code
| <code
| <code
|-
| [[APL (programming language)|APL]]
Line 3,044:
* {{note|JavaScript's technicalities|a}} JavaScript only uses floating point numbers so there are some technicalities.<ref name="Javascript numbers" />
* {{note|Perl's technicalities|b}} Perl doesn't have separate types. Strings and numbers are interchangeable.
* {{note|COBOL's NUMVAL alternatives|c}} <code
* {{note|Rust type conversion}} [https://doc.rust-lang.org/stable/std/primitive.str.html#method.parse <code
== [[Standard streams|Standard stream I/O]] ==
Line 3,131:
| <code><nowiki>(setf x (read-line))</nowiki></code>
| <code>(princ ''x'')</code><br/>or<br/><code>(format t ''format x'')</code>
| <code
|-
| [[Scheme (programming language)|Scheme]] ([[R6RS|R<sup>6</sup>RS]])
| <code
| <code>(display ''x'')</code><br/>or<br/><code>{{codett|(format #t|scheme}} ''format x'')</code>
| <code
|-
| [[ISLISP]]
| <code
| <code>{{codett|(format (standard-output)|lisp}} ''format x'')</code>
| <code>{{codett|(format (error-output)|lisp}} ''format x'')</code>
Line 3,201:
| <code><nowiki>$x = $*IN.get;</nowiki></code>
| <code>''x''.print</code><br/>or<br/><code>''x''.say</code>
| <code>''x''.note</code><br/>or<br/><code
|-
| [[Ruby (programming language)|Ruby]]
| <code>''x'' = gets</code>
| <code>puts ''x''</code><br/>or<br/><code>[[printf]](''format'', ''x'')</code>
| <code
|-
| [[Windows PowerShell]]
Line 3,306:
|-
| [[Scheme (programming language)|Scheme]] ([[R6RS|R<sup>6</sup>RS]])
| <code
| <code
| first argument
|-
Line 3,405:
|}
* {{note|Rust args|a}} In Rust, <code
* {{note|unseparated|b}} In Visual Basic, command-line arguments are not separated. Separating them requires a split function <code>Split(''string'')</code>.
* {{note|COBOL Arguments|c}} The COBOL standard includes no means to access command-line arguments, but common compiler extensions to access them include defining parameters for the main program or using <code
== Execution of commands ==
Line 3,428:
|-
| [[Objective-C]]
| <code
|
|-
Line 3,467:
| [[Java (programming language)|Java]]
|
| <code>Runtime.exec(''command'');</code><br/>or<br/><code
|
|-
Line 3,547:
| [[Bash shell]]
| <code>''output''=`''command''`</code><br/>or<br/><code>''output''=$(''command'')</code>
| <code
|
|}
|