Comparison of programming languages (basic instructions): Difference between revisions

Content deleted Content added
m Functions: {{codett}}
Line 2,636:
| rowspan="5" | <code>[[void type|void]] ''foo''(''«parameters»'') { ''instructions'' }</code>
| rowspan="5" | <code>''type'' ''foo''(''«parameters»'') { ''instructions ...'' return ''value''; }</code>
| rowspan=3| <code>''«global declarations»''<br/>{{codett|2=c|int main(«int argc, char *argv[]»)}} { {{indent|2}}''instructions''<br/>}</code>
|- valign="top"
| [[Objective-C]]
Line 2,643:
|- valign="top"
| [[Java (programming language)|Java]]
| <code>{{codett|2=java|public static void main(String[] args)}} { ''instructions'' }</code><br/>or<br/><code>{{codett|2=java|public static void main(String}}[[variadic function|...]] args) { ''instructions'' }</code>
|- valign="top"
| [[D (programming language)|D]]
| <code>{{codett|2=d|int main(«char[][] args»)}} { ''instructions''}</code><br/>or<br/><code>{{codett|2=d|int main(«string[] args»)}} { ''instructions''}</code><br/>or<br/><code>{{codett|2=d|void main(«char[][] args»)}} { ''instructions''}</code><br/>or<br/><code>{{codett|2=d|void main(«string[] args»)}} { ''instructions''}</code>
|- valign="top"
| [[C Sharp (programming language)|C#]]
Line 2,653:
| Same as above; alternatively, if simple enough to be an expression:
<code>[[void type|void]] foo(''«parameters»'') => ''expression'';</code>
| <{{code>|2=c#|static void Main(«string[] args») method_body</code>}}<br/>May instead return <code>int</code>.<br/>(starting with C# 7.1:) May return <code>Task</code> or <{{code><nowiki>|2=c#|Task<int></nowiki></code>}}, and if so, may be <code>async</code>.
|- valign="top"
| [[JavaScript]]
Line 2,699:
| 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>As</code> clause is not required if <code>Option Strict</code> is off. A type character may be used instead of the <code>As</code> clause.<br/>If control exits the function without a return value having been explicitly specified, the function returns the default value for the return type.
| rowspan=2| <code>{{codett|2=vbnet|Sub Main(««ByVal »args() As String»)}}{{indent|2}}''instructions''<br/>End Sub</code>or<br/><code>{{codett|2=vbnet|Function Main(««ByVal »args() As String») As Integer}}{{indent|2}}''instructions''<br/>End Function</code>
|- valign="top"
| [[Xojo]]
Line 2,758:
| <code>def ''foo''«(''parameters'')»«: Unit =» { ''instructions'' }</code>
| <code>def ''foo''«(''parameters'')»«: ''type»'' = { ''instructions ...'' «return» ''value'' }</code>
| <code>{{codett|2=scala|1=def main(args: Array[String])}} { ''instructions'' }</code>
|- valign="top"
| [[Windows PowerShell]]
Line 2,785:
|- valign="top"
| [[F Sharp (programming language)|F#]]
| <code>{{codett|2=f#|[<EntryPoint>] let main args}} ='' instructions''</code>
|- valign="top"
| [[Standard ML]]
Line 2,805:
| rowspan=2| [[CoffeeScript]]
| <code>foo()</code>
| <{{code>|2=coffeescript|1=foo = <nowiki>-></nowiki></code>}}
| <code>{{codett|2=coffeescript|1=foo = <nowiki>-></nowiki>}} ''value''</code>
| rowspan=2 {{n/a}}
|- valign="top"
| <code>foo ''parameters''</code>
| <{{code>|2=coffeescript|1=foo = <nowiki>() -></nowiki></code>}}
| <code>foo = ( ''parameters'' ) <nowiki>-></nowiki> ''value''</code>
|- valign="top"