Вы находитесь на странице: 1из 112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Introduction
What'sthisabout?
LanguageDesigners:
Lookingforoperatororfunctionnames?Wellhavealookatthefollowingandrememberusingexisting
onemayeasethetransition:)
LanguageUsers:
Youknowonelanguageandwanttofindthecorrespondingoperatororfunctioninanotherlanguage
Languagelovers:
Wanttoknowthevariouswayspeopleinventedforcommenting/assigning/...?
Thisisofcourseincomplete.Iwelcomecontributions!
Youmayalsohavealookatthisinformationsortedbylanguages.

LightVersion
Samecontentsplitintomultiplehtmlfiles

Categories
Various
commenting
documentationcomment
informationaboutthecurrentlineandfile
tokens
breakinglines(usefulwhenendoflineand/orindentationhasaspecialmeaning)
variableassignmentordeclaration
groupingexpressions
block(groupingstatements,especiallywhenstatementsarenotexpressions)
useablockasareturnvalue(whenstatementsarenotexpressions)
equality/inequality
comparison
runtimeevaluation
manualmemoryallocation
forcegarbagecollection
Functions
functioncall
partialapplication(intheexamplesbelow,anormalcallis"f(a,b)")
functiondefinition
anonymousfunction
functionreturnvalue
functioncalledwhenafunctionisnotdefined(indynamiclanguages)
runtimeinspectingthecallerinformation
functioncomposition
identityfunction
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

1/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

ControlFlow
sequence
if_then
if_then_else
ifnot_then(unless)
multipleselection(switch)
loop
breakingcontrolflow
exception
callwithcurrentcontinuation
Types
declaration
annotation(orvariabledeclaration)
cast
mutability,constness
ObjectOriented&Reflexivity
methodinvocation
objectcreation
objectcloning
manuallycallanobject'sdestructor
classdeclaration
testingclassmembership
getthetype/classcorrespondingtoanobject/instance/value
methodsavailable
inheritance
hasthemethod
currentinstance
accessingparentmethod
accessingchildmethod
Package,Module
packagescope
declare
import
Strings
typename
charactertypename
character"z"
strings
multiline
convertsomethingtoastring(seealsostringinterpolation)
serialize(marshalling)
unserialize(unmarshalling)
sprintflike
simpleprint
stringequality&inequality
stringsize
stringconcatenation
duplicatentimes
upper/lowercasecharacter
uppercase/lowercase/capitalizedstring
asciitocharacter
charactertoascii
accessingnthcharacter
extractasubstring
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

2/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

locateasubstring
locateasubstring(startingattheend)
Booleans
typename
falsevalue
truevalue
logicalnot
logicalor/and
BagsandLists
typename
listconcatenation
listflattening
listconstructor
list/arrayindexing
addinganelementatthebeginning(listcons)
addinganelementatindex
addinganelementattheend
firstelement
allbutthefirstelement
lastelement
allbutthelastelement
getthefirstelementandremoveit
getthelastelementandremoveit
foreachelementdosomething
transformalist(orbag)inanotherone
transformtwolistsinparallel
findanelement
keepelements
partitionalist:elementsmatching,elementsnonmatching
splitalist
isanelementinthelist
isthepredicatetrueforanelement
isthepredicatetrueforeveryelement
smallest/biggestelement
joinalistofstringsinastringusingagluestring
listsize
iteratewithindex
removeduplicates
sort
reverse
listofcouplesfrom2lists
2listsfromalistofcouples
lookupanelementinaassociationlist
listoutofabag
f(...f(f(init,e1),e2)...,en)
f(e1,f(e2,...f(en,init)...))
VariousDataTypes
tupletype
tupleconstructor
computabletuple(theseareakindofimmutablelistsplayingaspecialroleinparameterpassing)
reference(pointer)
optionalvalue
record
uniontypedeclaration
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

3/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

enumeratedtypedeclaration
dictionary
range
Mathematics
typename
numberssyntax
addition/subtraction/multiplication/division
exponentiation(power)
negation
random
operatorprioritiesandassociativities
squareroot/eexponential/absolutevalue
trigonometry
logarithm
euclidiandivision(bothquotientandmodulo)
modulo
truncate/round/floor/ceil
bitwiseoperators
Threads
threaddefinition
threadcreation
threadobjectcreation
starting/stoppingthreads
passingdatadirectlybetweenthreads
terminatingthreadcommunicationduetoatimeout
ThreadSynchronization
JoiningAnotherThread
ThreadPrioritization
Threadsafesharingofdatawithoutsynchronization

Various
commenting
untilendofline
#

Awk,BourneShell,CoffeeScript,E,FishShell,GNUbc,GNUsed,Icon,Io,Maple,merd,
Perl,Perl6,PHP,Pliant,Python,Ruby,Tcl,YAML

//

BCPL,C#,C++,C99,Dylan,F#,Io,Java,JavaScript,PHP,Pike,Scilab,YCP,Yorick

Ada,Cecil,Eiffel,Haskell,Lua,Sather,Simula,SQL92

Assembler,CommonLisp,EmacsLisp,Logo,MUMPS,Rebol,Scheme

Erlang,Matlab,Mercury,Oz,PostScript,Prolog,TeX

rem

Basic

'

VisualBasic

Forth

Assembler,Fortran90

NB.

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

4/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Cor*in
column1

Fortran

nestable
(*...*)

Beta,F#,Mathematica,Modula3,OCaml,Pascal,SML

%(...%)

Matlab

/*...*/

ClassicREXX,Dylan,Io,Oz,SQL99

{...}

Pascal,Rebol

{...}

Haskell

#|...|#(1)

CommonLisp,Scheme

#[...]

Perl6

#if0...#endif

comment{...}

Rebol

comment[...]

Rebol

[...](2)

Rebol

[[...]]

Lua

nonnestable
"..."

Smalltalk

/*...*/

B,C,C#,C++,CSS,GNUbc,Java,JavaScript,Mercury,PHP,Pike,PL/I,YCP,Yorick

<!...>

HTML,XML

(...)

Forth

###
...
###

CoffeeScript

documentationcomment
untilendofline
///

C#,F#,Java

Haskell

Haskell

nonnestable
/**...*/(3)

C,C#,E,Java,PHP

(**...*)

F#

{|...}

Haskell

(**...*)

OCaml

/*DOCUMENT...*/

Yorick

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

5/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

indexingidentifier:"...";

Eiffel

someClasscomment:'...'

Smalltalk

rebol[Note:"..."]

Rebol

func["..."arg]...

Rebol

classX:
"""...
"""

Python

defx():
"""...
"""
(4)
(define(fpara1para2)"..."...)

Scheme

(defunf(para1para2)"..."...)

Common
Lisp,
Emacs
Lisp

=pod
...
=cut

Perl,Perl6

(5)
=begin
...
=end

Ruby

functionMYFUNCTION
%MYFUNCTIONtheveryfirstcommentlineisdisplayedinthehelptableofcontents
%
Matlab
%theremaininglinesaredisplayedwhengettinghelpforMYFUNCTION
%

informationaboutthecurrentlineandfile
__LINE____FILE__

C,C++,Perl,PHP,Pike,Ruby

__LINE____SOURCE_FILE__

F#

$?LINE$?FILE

Perl6

__file__

Python

(newSystem.Diagnostics.StackFrame(true)).GetFileLineNumber()
C#
(newSystem.Diagnostics.StackFrame(true)).GetFileName()
Thread.currentThread().getStackTrace()[1].getLineNumber();
Thread.currentThread().getStackTrace()[1].getFileName();

Java

system/script/header/file(6)

Rebol

SOURCELINE()/parsesourceOS.SOURCENAME

ClassicREXX

infoframe0

Tcl8.5

thisContextlineNumber/thisContextmethodsource

Smalltalk

tokens
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

6/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

casesensitivity(keywords,variableidentifiers...)
casesensitive

Awk,B,BourneShell,C,C#,C++,CoffeeScript,F#,FishShell,Haskell,Io,Java,
JavaScript,Lua,Maple,Mathematica,Matlab,merd,Modula3,OCaml,Perl,
Perl6,Pike,Pliant,Prolog,Python,Ruby,Smalltalk,Tcl,XML,YAML,Yorick

caseinsensitive

Ada,Assembler,ClassicREXX,CommonLisp,CSS,Eiffel,Forth,HTML,Logo,
Pascal,PL/I,Rebol,SGML,SQL92,VisualBasic

casesensitive:
variables
caseinsensitive:
keywords,
functions,
constants...

PHP

casesensitive:
identifiers
caseinsensitive:
keywords

casesensitive:
identifiers
caseinsensitive:
commands

MUMPS

casesensitive:
uppercase
disallowed

GNUbc

whatisthestandardwayforscrunchingtogethermultiplewords
camelCase

CoffeeScript,JavaScript

CamelCaseorcamelCase

C#,E,Haskell,Io,Java,JavaScript,
Mathematica,Pascal,Smalltalk,Tcl,Visual
Basic

underscores

FishShell,GNUbc,merd

dots

Logo

hyphens

CommonLisp,EmacsLisp,Rebol,Scheme

underscoresforfunctions/types,unclearfor
modules/constructors

OCaml

UPPER_CASE

BourneShell

lowercasenoseparator

Matlab

underscores,UPPER_CASEforclassnames

Eiffel

CamelCaseforclasses,underscoresformethods

Python

CamelCasefortypes,underscoresforfunctions,
variables,...

Pliant

CamelCaseformethods,typesandmodules,underscore
forfunctions

F#

CamelCaseformodulesandclasses,ALL_CAPSfor
constants,underscoresforfunctions,variables,...

Ruby

CamelCaseformodulesandclasses,ALLCAPSfor
macros,underscoresformethods,constantsand
variables

Pike

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

7/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

CamelCaseformodules,ALL_CAPSforconstants,
unclearforfunctions/variables

Perl,Perl6

CamelCaseforvariables,underscoresforpredicates

Prolog

usuallylowercaseorunderscores,ALL_CAPSfor
macros

usuallyunderscores

C++

Camel_Case

Ada

variableidentifierregexp
[azAZ][azAZ09]*

FishShell,Mathematica,PL/I,Smalltalk

[azAZ][_azAZ09]*

Eiffel,Matlab

[azAZ](_?[azAZ09])*

Ada

[_azAZ][_azAZ09]*

Awk,B,C,C#,C++,E,Maple,PHP,Python,Tcl

[_azAZ09]+

BourneShell,Perl,Perl6

[azAZ09]+

FishShell

[_azAZ][_azAZ09]*or'[^']*'

Pliant

[_azAZ$][_azAZ09$]*

Java

[$AZaz_\x7f\uffff][$\w\x7f\uffff]*

CoffeeScript,JavaScript

[azAZ%][azAZ09]*

MUMPS

[_az][_azAZ09]*

Ruby

[_az][_azAZ09]*[!?']*

merd

[_az][_azAZ09']*

Haskell,OCaml,SML

[_azAZ][_azAZ09']*

F#

[_AZ][_azAZ09]*

Mercury,Prolog

[_azAZ!0&*/:<=>?^][_azAZ!0&*/:<=>?^09.+]*

Scheme

[azAZ!?@#][azAZ09!?@#]*

ClassicREXX

[_azAZ?!.'+*&|=~][_azAZ09?!.'+*&|=~]*or
[^09[](){}":;/][^\n\t[](){}":;/]*

Rebol

[az][az09_]*

GNUbc

anythingwithoutaspaceandisnotanumber

CommonLisp,Forth

functionidentifierregexp(ifdifferentfromvariableidentifierregexp)
[_azAZ][_azAZ09]*[!?]?

Ruby

[_az][_azAZ09]*

Mercury,Prolog

[^\t\n\r\f]+

Tcl

[^\t\n\r\f/]+

FishShell

keywordregexp(ifdifferentfromvariableidentifierregexp)
[AZ]+
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

8/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Modula3
typeregexp(ifdifferentfromvariableidentifierregexp)
[_AZ][_azAZ09']*

Haskell

[_az][_azAZ09']*

Mercury,OCaml

constantregexp(ifdifferentfromvariableidentifierregexp)
[AZ][_azAZ09]*

Ruby

[_AZ][_azAZ09']*

Haskell,OCaml

[_az][_azAZ09']*

Mercury

breakinglines(usefulwhenendoflineand/orindentationhasaspecialmeaning)
nothing
needed

Ada,B,C,C#,C++,CommonLisp,Eiffel,EmacsLisp,F#,Forth,Haskell,Java,JavaScript,
Maple,Mathematica,OCaml,Oz,Pascal,Perl,Perl6,PHP,PostScript,Rebol,Scheme,
Smalltalk,SML,XSLT,YCP

Awk,BourneShell,C,CoffeeScript,E,FishShell,GNUbc,Io,Python,Ruby,Tcl

VisualBasic

ClassicREXX

Logo

...

Matlab

variableassignmentordeclaration
assignment
=

Awk,B,Basic,BourneShell,C,C#,C++,ClassicREXX,Erlang,Icon,Io,Java,JavaScript,Lua,
Mathematica,Matlab,Oz,Perl,Perl6,PHP,Pike,YCP,Yorick

:=

Ada,BCPL,Cecil,Dylan,E,Eiffel,Maple,Mathematica,Modula3,Pascal,Pliant,Sather,
Simula,Smalltalk,SML

<

F#,OCaml

_(7)

Squeak

BCPL,Rebol

>(8)

Beta

def

PostScript

setq

CommonLisp,EmacsLisp

setf

CommonLisp

set

CommonLisp,FishShell,Rebol

SET
v=...

MUMPS

set!

Scheme

is

Prolog

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

9/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

make
"ve

Logo

ev!

Forth

declaration
=

Haskell,Mercury,Prolog

<

Haskell

Prolog

:=

Io

letv=ein

F#,OCaml

letvalv=ein

SML

letv=e(9)

BCPL,F#

defv:=e/varv:=e

my/our/local/usevars

Perl

my/our/temp

Perl6

define

Dylan,Scheme

letlet*

CommonLisp,Scheme

letrec

Scheme

fletlabelsdefundefmethoddefvardefparameterdefsetf..

CommonLisp

localV1=eV2=e2in...end

Oz

globalv1,v2

Python

globalv1v2

Matlab,Scilab

:@

Beta

NEWv

MUMPS

v:t

Ada,Eiffel,Pascal

tv

C,C#,C++,Java

|v1v2|

Smalltalk

autov1,v2;extrnv3,v4;

auto

GNUbc

var

JavaScript,Pliant

gvar

Pliant

variablev(10)

Forth

evaluev

Forth

Module[{x,y=v},...]

Mathematica

Block[{x,y=v},...]

Mathematica

With[{c1=v1,c2=v2,...},...]

Mathematica

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

10/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

XSLT

<xsl:variablename="v"select="e"/>

both
=

CoffeeScript,GNUbc,merd,Python,Ruby

:=

merd

set,variable

Tcl

groupingexpressions

(...)

Ada,Awk,B,BCPL,Beta,C,C#,C++,ClassicREXX,CoffeeScript,E,Eiffel,F#,GNU
bc,Haskell,Io,Java,JavaScript,Logo,Lua,Maple,Mathematica,Matlab,merd,Modula
3,MSH,MUMPS,OCaml,Oz,Pascal,Perl,Perl6,PHP,Pike,Pliant,Prolog,Python,
Rebol,Ruby,Scilab,Smalltalk,SML,SQL92,Tcl,XPath,YCP,Yorick

[...]

Rebol

indentation

merd

$...

Haskell

begin...
end

F#,FishShell,OCaml,Ruby

space(11)

merd

block(groupingstatements,especiallywhenstatementsarenotexpressions)
{...}

Awk,BCPL,BourneShell,GNUbc,GNUsed,JavaScript,
PHP,Pike,Tcl,Yorick

{...}(12)

B,C,C#,C++,E,Haskell,Java,Modula3,Perl,Perl6,YCP

(...)(12)

BourneShell

[...](13)

Logo,Smalltalk

"..."

Tcl

begin...end(12)

Ada,Pascal

(begin...)

Scheme

BEGIN...END

Modula3

do...end

ClassicREXX

do...end(12)

Lua,PL/I

indentation

CoffeeScript,F#,MUMPS,Pliant,Python

indentation(12)

Haskell,merd

foo...endwherefooin{if,do,
...}

Modula2,Ruby

foo...endwherefooin{if,for,
while,...}

Matlab,Scilab

foo...endwherefooin{if,loop,
...}

Eiffel

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

11/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

foo...endfoowherefooin{if,
do,...}

Ada,Fortran90

(*...*)(14)

BCPL

(#...#)

Beta

useablockasareturnvalue(whenstatementsarenotexpressions)
valof

BCPL

do

Perl,Perl6

proc()..endproc

Maple

equality/inequality
shallow
==!=

Awk,B,C,C++,CoffeeScript,F#,Io,Java,OCaml,Perl,Perl6,Pike,Yorick

=/=

Eiffel,Fortran90

=<>

Forth,Logo,Maple,Modula2,Pliant,Rebol

=#(15)

Modula2,Modula3

=!=

BourneShell,FishShell

=====!=!==(16)

JavaScript,PHP

===!==

Perl6,PHP5

==~=

Lua

==~~

Smalltalk

==~==

Dylan

='=

MUMPS

=~=neqv(14)

BCPL

f=f<>

Forth

is_equal(17)

Eiffel

eqne

EmacsLisp,PostScript

eq,eql

CommonLisp

eq?eqv?

Scheme

.EQ..NE.

Fortran

is/isnot

Python

deep
==!=

Awk,C#,C++,E,merd,PHP5,Python,Ruby,Tcl,YCP

==<>

Python

==/=

Haskell

==\=

Oz

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

12/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

==\==

ClassicREXX,Prolog

=/=

Ada

=!=

Maple,XPath

=<>

Beta,F#,OCaml,Pascal,Rebol,SML,SQL92,Visual
Basic

=~=

Dylan,Smalltalk

==~=eqneisequal
isequalwithequalnans

Matlab

==~=eqneisequal

Scilab

=@=\=@=/=\=/=:==\=(18)

Prolog

====!=/==!=(19)

Mathematica

.eq

Logo

equal?

Scheme

equals

Java

equal

CommonLisp,EmacsLisp,Pike

equalp

CommonLisp

eqv

Perl6

deep_is_equal

Eiffel

isEqual

ObjectiveC

comparison

<><=
>=

Ada,Awk,Awk,B,Beta,C,C#,C++,ClassicREXX,CoffeeScript,CommonLisp,Dylan,E,
Eiffel,EmacsLisp,F#,Forth,Haskell,Io,Java,JavaScript,Logo,Lua,Maple,Mathematica,
Matlab,merd,Modula3,OCaml,Pascal,Perl,Perl6,PHP,Pike,Pliant,Python,Rebol,Ruby,
Scheme,Scilab,Smalltalk,SML,SQL92,Tcl,VisualBasic,XPath,YCP,Yorick

<>=<
>=

Mercury,Oz

<>'>
'<

MUMPS

<<>>
<<=>>=
(20)

ClassicREXX

@</@=
</@>
/@>=

Prolog

ltgt
lege

Perl,Perl6,PostScript

ltgt
lege

BourneShell,FishShell,MSH

.LT.
.GT.

Fortran

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

13/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

.LE.
.GE.
u<u>
u<=u>=

Forth

f<f>

Forth

returns3values(i.e.inferior,equalorsuperior)
a<=>b

merd,Perl,Perl6,Ruby

cmp

Perl,Perl6,Python

compare

F#,Forth,Haskell,Mercury,OCaml,Pliant,Prolog,Smalltalk

strcmp

C,PHP

three_way_comparison

Eiffel

stringcompare

Tcl

compareTo

Java

returns4values(i.e.inferior,equal,superiorornotcomparable)
compare

Pliant

compareTo

min/max(binaryormore)
min/max

Beta,C++,CommonLisp,Dylan,E,Eiffel,F#,Forth,Haskell,Io,Java,Lua,
Maple,Matlab,merd,OCaml,PHP5,Pike,Pliant,Prolog,Python,Rebol,Scheme,
Scilab,Smalltalk,SQL92,Tcl8.5,Yorick

minminstr/max
maxstr(21)

Perl

Min/Max

Mathematica,Oz

MIN/MAX

ClassicREXX,Modula3

measureobject
min/measure
objectmax

MSH

fmin/fmax

Forth

Integer'min/
Integer'max

Ada

runtimeevaluation
eval

BourneShell,CommonLisp,EmacsLisp,FishShell,JavaScript,
Matlab,Perl,Perl6,PHP,Python,Ruby,Scheme,Tcl,YCP

CoffeeScript.eval(22)

CoffeeScript

exec

Python

evstr/execstr

Scilab

dostring

Lua

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

14/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

doString

Io

evaluate

Forth

Compilerevaluate:

Smalltalk

runtime_compile/compile+
execute

Pliant

Compiler.evalExpressionor
Compiler.parseOzVirtualString

Oz

compile_string

Pike

interpret

ClassicREXX

ToExpression

Mathematica

run

Logo

XECUTE

MUMPS

do/reduce/compose/load

Rebol

[...]

Tcl

=..(23)

Prolog

manualmemoryallocation
allocation
malloc

allocatethrow

Forth

new

Ada

deallocation
free

freethrow

Forth

forcegarbagecollection
doGC

Beta

GC.start

Ruby

gc

Logo,Maple,Pike

System.gc()

Java

System.gcDo

Oz

System.GC.Collect()

C#,F#

gc.collect()

Python

gc_collect_cycles(24)

PHP5

full_collect

Eiffel

garbage_collect

Mercury,Prolog

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

15/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

collectgarbage

Lua

Collectorcollect

Io

VM.garbageCollect()

JavaScript

Gc.full_major()

OCaml

SmalltalkgarbageCollect

Smalltalk

System.Mem.performGC

Haskell

incrementalgarbagecollection=>notneeded

Perl,Perl6

recycle

Rebol

interp.gc()

(ext:gc)

CommonLisp

Functions
functioncall

f(a,b,...)

Ada,Awk,Awk,B,C,C#,C++,CoffeeScript,CSS,Dylan,
E,Eiffel,Erlang,Io,Java,JavaScript,Lua,Maple,Matlab,
Mercury,merd,Modula3,Pascal,Perl,Perl6,PHP,Pike,
Prolog,Python,Ruby,XPath,YCP,Yorick

fab...

BourneShell,F#,FishShell,Haskell,Logo,Matlab,MSH,
OCaml,Pliant,Rebol,SML,Tcl

f(a,b,...f)orf[a,b,...]dependingon
theversion

BCPL

(fab...)(applyfl)

CommonLisp,EmacsLisp,Scheme

(funcallfab...)

CommonLisp,EmacsLisp

{fab}

Oz

[applyfab]

Tcl8.5

f[a,b,...]

Mathematica

f[a,b,...]orf.call(a,b,...)

Ruby

&$f(a,b,...)or$f>(a,b,...)

Perl

$f.(a,b,...)

Perl6

fa,b,...

CoffeeScript,Perl

f,a,b,...(25)

Yorick

v=f(a,b,...)orcallfa,b,...

ClassicREXX

ab...f

Forth,PostScript

(a,b,...)>&for(a,b,...)>f

Beta

f:a(26)

FL

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

16/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

f@a(27)

Mathematica

a//f(27)

Mathematica

a~f~b(28)

Mathematica

..[f,A,B,...]

Prolog

<xsl:calltemplatename="f">
<xsl:withparamname="a"select=a/>
XSLT
<xsl:withparamname="b"select=b/>
</xsl:calltemplate>

withnoparameter
f

Ada,BourneShell,Eiffel,Forth,Haskell,Io,Logo,Matlab,Mercury,MSH,Pascal,
Perl,Perl6,Pliant,PostScript,Prolog,Rebol,Ruby,Tcl,Yorick

f()

Awk,C,C#,C++,CoffeeScript,E,Erlang,F#,Java,JavaScript,Lua,Maple,merd,
OCaml,Perl,PHP,Pike,Python,SML,YCP

(f)

CommonLisp,EmacsLisp,Scheme

(funcallf)

CommonLisp,EmacsLisp

{f}

Oz

f[]

Mathematica

f[]orf.call

Ruby

&$for$f>()

Perl

$f.()

Perl6

v=f()

ClassicREXX

callf

ClassicREXX,Fortran

fvalue(29)

Smalltalk

<xsl:call
template
name="f">/

XSLT

partialapplication(intheexamplesbelow,anormalcallis"f(a,b)")
givethefirstargument
fa

F#,Haskell,OCaml,SML

f(a)

Mercury

f(a,)

merd

&f.assuming(var_name=>a)

Perl6

functools.partial(f,a)(30)

Python

interpalias{}f_a{}fa

Tcl

givethesecondargument
f(,b)

merd

&f.assuming(b=>b)

Perl6

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

17/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

flipfb(31)

Haskell

givethefirstargumenttooperator">"
(a>)

Haskell,merd

(>)a

F#,OCaml

givethesecondargumenttooperator">"
(>a)

Haskell,merd

functiondefinition
subf{...}

Perl,Perl6

subf($para1,$para2,...){...}

Perl6

deff(para1,para2,...):...

Python

deff(para1,para2,...)...end

Ruby

deff(para1,para2,...)...{...}

fpara1para2=...

Haskell

letfpara1para2=...

F#,OCaml

f(para1,para2,...)=valof$(...$)

BCPL

f(para1,para2,...)=...

merd

f[para1_,para2_,...]:=...para1...

Mathematica

f...orf:para1...

Smalltalk

f:func[para1para2...]...

Rebol

/f{...}def

PostScript

f:=(para1,para2,...)>...

Maple

f:=method(para1,para2,...,code)

Io

funcf(a,b,c...){...}

Yorick

typ0f(typ1para1,typ2para2,...){...}

C,C#,C++,Pike,YCP

functionf(para1,para2){...}

Awk,JavaScript,PHP5

functionf(para1,para2)...code...end

Lua

functionf;...;end

FishShell

functionf{...}

KornShell

functionf{param(para1,[typ2]para2,...)...}

MSH

(define(fpara1para2)...)

Scheme

(defunf(para1para2)...)

CommonLisp,EmacsLisp

fun{FPara1Para2}...end

Oz

funfpara1para2=...

SML

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

18/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

procf{para1para2}{...}

Tcl

functionretval=f(para1,para2)
retval=...

Matlab,Scilab

:funcf(typ1,typ2,...)=typ0.
f(Para1,Para2,...)=...

Mercury

functionf(para1:type1;para2:typ2;...)returnretvalis
begin
Ada
...
endf;
functionfpara1para2>retval
argtyp1para1;argtyp2para2;argrettypretval;
...

Pliant

functionf(para1:typ1,para2:typ2,...):retval;
varretval:typ0;
begin
...
end

Pascal

f(para1:typ1;para2,para3:typ2;...):rettypis
do
...
end

Eiffel

<xsl:templatename="f">
<xsl:paramname="para1"/>
<xsl:paramname="para2"/>

XSLT

...
</xsl:template>
Functionf(para1,para2)...EndFunction

VisualBasic

:f...;

Forth

f(){...}

BourneShell,KornShell

f:procedure
...
returnretval

ClassicREXX

tof:para1:para2
...
end

Logo

procedures
proceduref(para1:typ1;para2,para3:typ2);
begin
...
end

Pascal

f(para1:typ1;para2,para3:typ2;...)is
do
...
end

Eiffel

proceduref(para1:typ1;para2:MODEtype2;...)is
begin
...
endf;
Ada
MODE::=|OUT|INOUT
voidf(typ1para1,typ2para2,...){...}
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

C,C#,C++,Pike
19/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

letf(para1,para2,...)be$(...$)

BCPL

proc{FPara1Para2}...end

Oz

f:=proc(para1,para2,...)...endproc

Maple

Subf(para1,para2)...EndSub

VisualBasic

functionf(para1,para2)
...

Matlab,Scilab

f:procedure
...
return

ClassicREXX

variablenumberofarguments
onecanuseoverloadingondifferentnumberofarguments

C++,Java

subf{...@_}

Perl

subf;...$argv;end

FishShell

f(){...$@}

BourneShell

f:=...##&

Mathematica

f[params___]:=...params...

Mathematica

functionf(varargin)
fori=1:nargin
...(varargin{i})
end

Matlab

functionf(varargin)
fore=varargin
...(e)
end

Scilab

(args...)>...

CoffeeScript

(lambdax...)or(32)

Scheme

predicates
f(Para1,Para2,....):....

Prolog

anonymousfunction
sub{my($a,$b)=@_;...}

Perl

{my($a,$b)=@_;...}(33)

Perl

{...}(argumentsareinthestack

PostScript

[...]

Logo

{param(para1,[typ2]para2,...)...}

MSH

{|a,b|...}(34)

Ruby

[:a:b|...]

Smalltalk

[list{ab}{...}]

Tcl8.5

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

20/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

lambdaa,b:...

Python

lambda(typ1para1,typ2,para2,...){...};

Pike

(a,b)=>...

C#3,CoffeeScript

(a,b)>...

CoffeeScript,Maple

a,b>...

merd

>$a,$b{...}

Perl6

\ab>...

Haskell

:noname...

Forth

fn(a,b)=>...

SML

funab>...

F#,OCaml

(func(A,B)=C:...)

Mercury

function(a,b){...}

JavaScript,PHP5

function(a,b)use(&$v1,$v2){...}(35)

PHP5

function(a,b)...end

Lua

Function[{a,b},....](36)

Mathematica

fun(a,b)>...end

Erlang

fun{$AB}...end(37)

Oz

func[ab...]...

Rebol

def_(para1,para2,...)...{...}

proc{|a,b|...}

Ruby

lambda{|a,b|...}

Ruby

(lambda(ab)...)

CommonLisp,EmacsLisp,Scheme

inline('...x...y...')(38)

Matlab

method(a,b,...)

Io

method(a,b)...endmethod(39)

Dylan

create_function(',','...')

PHP

delegate(taa,tbb){...}

C#2

[](taa,tbb){...}

C++0x

[](taa,tbb)>typ{...}

C++0x

functionreturnvalue
breaksthecontrolflow
return(40)

Ada,Awk,B,BCPL,BourneShell,C,C#,C++,ClassicREXX,CoffeeScript,Common
Lisp,E,FishShell,Io,Java,JavaScript,Lua,Maple,Matlab,Perl,Perl6,PHP,Pike,
Pliant,Python,Rebol,Ruby,Tcl,YCP,Yorick

Return

Mathematica,VisualBasic

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

21/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

RETURN

Modula3

resultis(41)

BCPL

returnfrom
xxx

CommonLisp

Smalltalk

Exit
Function/
ExitSub

VisualBasic

exit

Forth

output

Logo

functionbodyistheresult
nosyntax
needed(42)

CoffeeScript,CommonLisp,Dylan,EmacsLisp,Erlang,F#,Haskell,Io,Maple,
Mathematica,Matlab,OCaml,Oz,Perl,Perl6,Rebol,Ruby,Scheme,SML,Tcl

settingtheresult
Result:=val

Eiffel

<functionname>=val

VisualBasic

<functionname>:=val

Pascal

<retvarname>=val;

Ada,Matlab

functioncalledwhenafunctionisnotdefined(indynamiclanguages)
AUTOLOAD

Perl

AUTOSCALAR,AUTOMETH,AUTOLOAD...

Perl6

__autoload

PHP5

__getattr__

Python

method_missing

Ruby

doesNotUnderstand

Smalltalk

__noSuchMethod__(43)

CoffeeScript,JavaScript

unknown

Tcl

noapplicablemethod

CommonLisp

doesNotRecognizeSelector

ObjectiveC

TryInvokeMember(44)

C#

match[name,args]{...}

thepredicatefail

Prolog

forward

Io

runtimeinspectingthecallerinformation
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

22/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

caller

Perl,Perl6,Ruby

call

Io

inspect.stack()[1]

Python

backtrace

Pike

debug_backtrace

PHP5

trace'I'

ClassicREXX

evalin('caller',...)

Matlab

current_predicate

Prolog

thisContextsender

Smalltalk

where(2)

Maple

infolevel

Tcl

functioncomposition
.

Haskell

merd

SML

Maple

compose

Dylan

Composition

Mathematica

<<

F#

>>

F#

identityfunction
id

Haskell

identity

CommonLisp

Identity

Mathematica

yourself

Smalltalk

ControlFlow
sequence
,

C,C++,JavaScript,Matlab,Perl,Pike,Prolog,Scilab

Smalltalk

Ada,Awk,B,Beta,BourneShell,C,C#,C++,E,F#,FishShell,GNUsed,Haskell,Io,
Java,JavaScript,Maple,Mathematica,Matlab,merd,Modula3,OCaml,Pascal,Perl,

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

23/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Perl6,PHP,Pike,PL/I,Pliant,Python,Ruby,SML,Tcl,YCP
:

Maple

nothing,
optionally;

ClassicREXX,Lua

space

Eiffel,Rebol

endofline

Assembler,Awk,Basic,BourneShell,CoffeeScript,E,F#,FishShell,Fortran,GNUsed,
Haskell,Io,JavaScript,Lua,Matlab,merd,Pliant,Python,Ruby,Tcl

(begin...)

Scheme

(progn...)
(prog1...)
(prog2...)

CommonLisp,EmacsLisp

>>

Haskell

if_then
ifcthen...

CoffeeScript,F#,merd,OCaml,Pascal,Tcl

ifcthen...end

Eiffel,Lua,Oz,Ruby

ifcthen...endif

Ada,Maple

ifcthen...fi

Maple

ifc;then...fi

BourneShell

if(c)then...end

Dylan

ifcdo...

BCPL

IFcTHEN...END

Modula2,Modula3

if(c)...

Awk,B,C,C#,C++,Java,JavaScript,PHP,Pike,YCP

ifc:...

Python

ifc...

Pliant,Rebol,Tcl

if(c):...endif

PHP

ifc{...}

Perl6

ifc[...]

Logo

if(c){...}

E,Perl,Yorick

IFc...

MUMPS

c>...

FL

c...if

PostScript

...ifc

Perl,Ruby

cifb1then

Forth

(ifc...)

CommonLisp,Scheme

(whenc...)

EmacsLisp

cand...

Perl,Ruby

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

24/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

if(c,...)

Io

If[c,...]

Mathematica

if(c)then(...)

Io

cifTrue(...)

Io

cifTrue:...

Smalltalk

<xsl:iftest="c">...</xsl:if>

XSLT

IfcThen...

VisualBasic

Ifc
...
EndIf

VisualBasic

ifc;...end

Ruby

ifc;...;end

FishShell

ifc,...,end

Matlab

ifc
...
end

Matlab,Ruby

ifcthen;...
ifcthen
...

ClassicREXX

ifcthendo
...
end
cand...

Perl

tlabel

GNUsed

ifc
...

CoffeeScript

if_then_else
ifcthenb1elseb2

CoffeeScript,F#,Haskell,merd,OCaml,SML

ifcthenb1elseb2end

Eiffel,Lua,Ruby

ifcthenb1elsifc2thenb2elseb3
endif

Ada

ifcthenb1elseifc2thenb2elseb3
end

Eiffel,Oz

if(c)thenb1elseif(c2)thenb2else
b3end

Dylan

IFcTHENb1ELSIFc2THENb2ELSEb3
END

Modula3

IfcThenb1ElseIfc2Thenb2Elseb3
EndIf

Modula2

if(c)b1elseb2

Awk,B,C,C#,C++,Java,JavaScript,Pike,YCP

ifcb1elsifc2b2b3

Tcl

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

25/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

ifcthenb1elseifc2thenb2elseb3

Tcl

ifcthenbeginb1endelsebeginb2
end

Pascal

ifcb1eifc2b2elseb3

Pliant

ifcthenb1elifc2thenb2elseb3
endif

Maple

ifc;thenb1;elifc2;thenb2;else
b3;fi

BourneShell

ifc;b1;elseb2;end

FishShell

ifc1,b1,elseifc2,b2,else,b3,end

Matlab

if(c)b1elseif(c2)b2elseb3

PHP

if(c):b1elseif(c2):b2else:b3
endif

PHP

if(c){b1}elsif(c2){b2}else{b3}

Perl

if(c){b1}else{b2}

E,Yorick

(ifcb1b2)

CommonLisp,Scheme

(ifcthenb1elseb2)

Mercury

(c>b1;c2>b2;b3)

Mercury

c>b1;b2

FL

if(c,b1,b2)

Io

If[c,b1,b2]

Mathematica

if(c)then(b1)else(b2)

Io

cifTrue:b1ifFalse:b2

Smalltalk

ifelsec[b1][b2]

Logo

shuntcb1c2b2b3

Pliant

eithercb1b2/if/elsecb1b2

Rebol

(cond(cb1)(c2b2)(tb3))

CommonLisp,EmacsLisp

(cond(cb1)(c2b2)(elseb3))

Scheme

Which[c,b1,c2,b2,True,b3]

Mathematica

c>b1;c2>b2;b3

Prolog

casewhenc;b1whenc2;b2elseb3end

Ruby

testcthenb1orb2

BCPL

e|c=b1|c2=b2|otherwise=
b3(45)

Haskell

cb1b2ifelse

PostScript

cifb1elseb2then

Forth

c?b1:b2

Awk,B,C,C#,C++,Java,JavaScript,Perl,PHP,Ruby,
Tcl,YCP,Yorick

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

26/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

c??b1!!b2

Perl6

b1ifcelseb2(30)

Python

$SELECT(c:b1,c2:b2,1:b3)

MUMPS

c>b1,b2

BCPL

(ifcthenb1elseb2fi)

Beta

<xsl:choose>
<xsl:whentest="c">b1</xsl:when>
<xsl:whentest="c2">b2</xsl:when> XSLT
<xsl:otherwise>b3</xsl:otherwise>
</xsl:choose>
IfcThenb1Elseb2

VisualBasic

Ifc
b1
Else
b2
EndIf

VisualBasic

ifc:
b1
elifc2:
b2
else:
b3

Python

ifc
b1
elsifc2
b2
else
b3
end

Ruby

ifc
b1
elseifc2
b2
else
b3
end

Matlab

ifcthen;b1;else;b2
ifcthen
b1
else
b2
ifcthendo
b1
...
end
elsedo
b2
...
end

ClassicREXX

IFc...
ELSE...

MUMPS

ifc
b1
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

27/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

elseifc2
b2
else
b3

CoffeeScript

ifnot_then(unless)
unless

CoffeeScript,EmacsLisp,Perl

ifFalse

Smalltalk

if(c)notthen(...)

Io

multipleselection(switch)
switch(val){
casev1:...;break;
casev2:casev3:...;break;
default:...;
}

C,C++,Java,JavaScript,PHP,Pike

switchval{
casev1:...;gotodone;
casev2:casev3:...;gotodone;
}
...;
done:

switch(val){
casev1:...;break;
casev2:casev3:...;break;
default:...;break;
}

C#

(46)
switch(val){
matchv1{...}
matchv2{...}
match_{...}
}

switchonval
casev1:...
casev2:...
default:...

BCPL

switchval
casev1
...
casev2v3
...
case'*'
...
end

FishShell

switchval
casev1
...
case{v2,v3}
...
otherwise

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

Matlab

28/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

...
end
casevalof
v1:...;
v2,v3:...
else...
end

Pascal

switchval{
v1{...}
v2v3{...}
default{...}
}

Tcl

casevalin
v1)statement1;;
v2|v3)statement23;;
*)statement_else;;
esac

BourneShell

(ifval
//v1then...
//v2then...
else...
if)

Beta

matchvalwith
|v1>...
|v2|v3>...
|_>...

F#,OCaml

casevalof
v1=>...
|v2=>...
|_=>...

SML

CASEvalOF
v1=>...
|v2=>...
ELSE=>...END

Modula3

casevalof
v1>...
v2>...
_>...

Haskell

valcase
v1of...endof
v2of...endof
...
endcase

Forth

val.
v1>...
v2>...
_>...

merd

(caseval
((v1)...)
((v2)...)
(otherwise...))

CommonLisp

(caseval
((v1)...)
((v2)...)
(else...))

Scheme

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

29/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

casevalis
whenv1=>...
whenv2|v3=>...
whenothers=>...
endcase;

Ada

caseval
whenv1;...
whenv2,v3;...
else...
end

Ruby

inspectval
whenv1thenstatement1
whenv2,v3=>statement23
elsestatement_else
end

Eiffel

select(val);
when(v1)statement1;
when(v2,v3)statement23;
otherwisestatement_else;
end;

PL/I

X=val,
(X=v1,...;X=v2,...;...)

Mercury,Prolog

my%case=(
v1=>sub{...},
v2=>sub{...},
);
if($case{val}){$case{val}>()}else{...}

Perl

useSwitch;
switch($val){
casev1{...}
casev2{...}
else...
})

Perl

(47)
given$val{
whenv1{...}
whenv2{...}
default{...}
}

Perl6

Selectval
Casev1

...
Casev2,v3

...
CaseElse

...
EndSelect

VisualBasic

switch(val){
v1{...}
v2{...}
default{...}
}

MSH

switchval[
v1[...]
v2[...]
]
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

Rebol
30/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

switch/default[
v1[...]
v2[...]
][...]
valcaseOf:{[v1]>[...].[v2]>[...]}otherwise:...

Squeak

Switch[val,v1,...,v2,...,_,...]

Mathematica

select
whenv1...
whenv2|v3...
otherwise...
end

ClassicREXX

CASEval
WHENv1THEN...
WHENv2THEN...
ELSE...
END

SQL92

loop
foreverloop
loop

CoffeeScript,merd,Perl6,PostScript,Ruby

loop(...)

Io

loop...endloop

Ada

LOOP...END

Modula3

(loopdo...)

CommonLisp

cycle(#do...#)

Beta

repeat

Squeak

begin...again

Forth

forever

Logo,Rebol

Do
...
Loop

VisualBasic

doforever
...
end

ClassicREXX

whileconditiondosomething
while(c)...

Awk,B,C,C#,C++,E,Java,JavaScript,Perl,PHP,Pike,
Ruby,YCP,Yorick

whilec...

CoffeeScript,Perl6,Tcl

whilecloop...endloop

Ada

whilecdo...

BCPL,Pascal,SML

whilecdo...done

F#,OCaml

whilecdo...enddo

Maple

whilecdo...end

Lua

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

31/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

WHILEcDO...END

Modula3

whilec:...

Python

whilec;do...;done

BourneShell

whilec;...;end

FishShell

whilec,...,end

Matlab

while[c][...]

Rebol

whilec[...]

Logo

while(c,...)

Io

While[c,...]

Mathematica

do.while[...]c

Logo

cwhileTrue:...

Smalltalk

(loopwhilecdo...)

CommonLisp

loop(#while::<(#doc>value#)
do...#)

Beta

begincwhile...repeat

Forth

fromuntilnotcloop...end

Eiffel

whilec
...

Pliant

whilecdo
...

F#

DoWhilec
...
Loop

VisualBasic

dowhilec
...
end

ClassicREXX

dosomethinguntilcondition
do...untilc

Perl6

do{...}untilc

Perl

do...while(!c)

Awk,C,C#,C++,Java,JavaScript,Pike,Yorick

begin...enduntilc

Ruby

begin...cuntil

Forth

REPEAT...UNTILc

Modula3

loop(#until::<(#doc>value#)do...#)

Beta

loop...exitwhenc;endloop

Ada

(loopdo...untilc)

CommonLisp

...repeatuntilc

BCPL

repeat...untilc

Lua,Pascal

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

32/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

repeat...until(c)

YCP

repeat,...,c

Prolog

until[...c]

Rebol

untilc[...]

Logo

do.while[...]c

Logo

While[...;c]

Mathematica

[...]whileFalse:[c]

Smalltalk

Do
...
LoopUntilc

VisualBasic

foreachvalueinanumericrange,1increment(seealsotheentriesaboutranges)
for(inti=1;i<=10;i++)...

C,C#,C++

for(i=1;i<=10;i++)...

Awk,JavaScript

for($i=1;$i<=10;$i++)...

PHP

foreachmy$i(1..10){...}

Perl

foreach($iin1..10){...}

MSH

for(1..10)>$i{...}

Perl6

fori=1:10,...,end

Matlab

fori=1,10do...end

Lua

fori:=1to10do...

Pascal

fori=1to10do...done

F#,OCaml

Fori=1To10...Next

VisualBasic

foriin1..10loop...endloop

Ada

foriin1..10do...done

F#

foriin[1..10]...

CoffeeScript

foriinxrange(1,11)

Python

foriin(seq10);...;end

FishShell

FORI=1:1:10...

MUMPS

forifrom1to10do...enddo

Maple

for[i110+1][...]

Logo

for{seti1}{$i<=10}{incri}{...}

Tcl

1110...for

PostScript

111do...loop

Forth

(1..10).each{|i|...}

Ruby

1.upto(10){|i|...}

Ruby

1to(10)foreach(...)
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

33/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Io
1to:10do:[...]

Smalltalk

(loopforifrom1to10do...)

CommonLisp

dolabeli=1,10

Fortran

Do[...,{i,1,10}](48)

Mathematica

doi=1for10
...
end

ClassicREXX

foreachvalueinanumericrange,1decrement
forX:=10downto1do...

Pascal

fori=10downto1do...done

F#,OCaml

foriinreverse1..10loop...endloop

Ada

foriin10..1..1do...done

F#

for(inti=10;i>=1;i)...

C,C#,C++

for(my$i=10;$i>=1;$i){...}

Perl

loop(my$i=10;$i>=1;$i){...}

Perl6

for(i=1;i<=10;i)...

Awk,JavaScript

for($i=1;$i<=10;$i)...

PHP

fromi:=10untili<1loop...i:=i1end

Eiffel

fori=10:1:1,...,end

Matlab

fori=10,1,1do...end

Lua

Fori=10To1Step1...Next

VisualBasic

foriinxrange(10,0,1)

Python

foriin`seq1011`;do...;done

BourneShell

foriin(seq1011);...;end

FishShell

forifrom10to1by1do...enddo

Maple

for[i1101][...]

Logo

FORI=10:1:1...

MUMPS

for{seti10}{$i>=1}{incri1}{...}

Tcl

1011...for

PostScript

110do...1+loop

Forth

1to:10by:1do:[...]

Smalltalk

10to(1)foreach(...)

Io

10.downto(1){|i|...}

Ruby

(loopforifrom1to10by1do...)

CommonLisp

dolabeli=10,1,1
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

34/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Fortran
Do[...,{i,10,1,1}]

Mathematica

doi=10to1by1
...
end

ClassicREXX

foriin[10..1]...

CoffeeScript

foreachvalueinanumericrange,freeincrement
for(inti=1;i<=10;i+=2)...

C,C#,C++,Pike

for(i=1;i<=10;i+=2)...

Awk,JavaScript

for($i=1;$i<=10;$i+=2)...

PHP

for(my$i=1;$i<=10;$i+=2){...}

Perl

loop(my$i=1;$i<=10;$i+=2){...}

Perl6

fromi:=1untili>10loop...i:=i+2end

Eiffel

fori=1:3:10,...,end

Matlab

fori=1,10,2do...end

Lua

Fori=1To10Step2...Next

VisualBasic

foriin1..2..10do...done

F#

foriinxrange(1,11,2)

Python

foriin(seq1210);...;end

FishShell

forifrom1to10by2do...enddo

Maple

for[i1102][...]

Logo

FORI=1:2:10...

MUMPS

for{seti0}{$i<=10}{incri2}{...}

Tcl

1210...for

PostScript

111do...2+loop

Forth

1to:10by:2do:[...]

Smalltalk

(1..10).step(2){|i|...}

Ruby

1to(9,2)foreach(...)

Io

(loopforifrom1to10by2do...)

CommonLisp

dolabeli=1,10,2

Fortran

Do[...,{i,1,10,2}]

Mathematica

doi=1to10by2
...
end

ClassicREXX

foriin[1..10]by2...

CoffeeScript

for"alaC"(while+initialisation)
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

35/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

for

Awk,C,C#,C++,Java,JavaScript,Mathematica,
MSH,Perl,PHP,Pike,Tcl,Yorick

loop

Perl6

for((x=0;x<10;x++));do...;done

BourneShell

frominit_codeuntilcloop...
incr_statementend

Eiffel

(loopwithVAR=INITIALVALUE...while
CONDITIONfinallyINCREMENT...)

CommonLisp

breakingcontrolflow
returningavalue
return(40)

Ada,Awk,B,BCPL,BourneShell,C,C#,C++,ClassicREXX,CoffeeScript,Common
Lisp,E,FishShell,Io,Java,JavaScript,Lua,Maple,Matlab,Perl,Perl6,PHP,Pike,
Pliant,Python,Rebol,Ruby,Tcl,YCP,Yorick

Return

Mathematica,VisualBasic

RETURN

Modula3

resultis(41)

BCPL

returnfrom
xxx

CommonLisp

Smalltalk

Exit
Function/
ExitSub

VisualBasic

exit

Forth

output

Logo

goto(unconditionaljump)
goto

Ada,B,Basic,BCPL,C,C#,C++,Cobol,Fortran,Logo,MUMPS,Pascal,Perl,PHP5,
Yorick

Goto

Mathematica

gothrow

CommonLisp

signal

ClassicREXX

GNUsed

b,bra,
jmp

Assembler

continue/break
continue/break

Awk,C,C#,C++,CoffeeScript,E,FishShell,Io,Java,JavaScript,Matlab,PHP,
Pike,Python,Tcl,YCP,Yorick

Continue/Break

Mathematica

next/last

Perl,Perl6

next/break(49)

Maple,Ruby

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

36/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

/break

BCPL,Lua

/break/return

Rebol

/exit

Ada,PostScript

/stop

Logo

restart/leave

Beta,Pliant

/ExitDo,ExitFor

VisualBasic

/returnfromxxx
orreturn

CommonLisp

iterate/leave

ClassicREXX

/leave

Forth

redo/retry
redo/

Perl,Perl6

redo/retry

Io,Ruby

exception
throwing
raise

Ada,Eiffel,F#,merd,OCaml,Python,Ruby,SchemeSRFI34,SML

RAISE

Modula3

raise...end

Oz

Exceptionraise

Io

throw

C#,C++,CoffeeScript,E,Erlang,Forth,Haskell,Java,JavaScript,Logo,
PHP5,Pike,Prolog,Rebol

Throw

Mathematica

throw/name

Rebol

die

Perl,Perl6

returncode

Tcl

error

CommonLisp,Dylan,EmacsLisp,Lua,Lua,Maple,Matlab,Pliant,
Yorick

signal

CommonLisp,Dylan,Smalltalk

signal
predefined_condition_name

ClassicREXX

cerrorwarn

CommonLisp

[NSExceptionraise:name
...]

ObjectiveC

catching
try:aexceptexn:...

Python

tryawithexn>...

F#,OCaml

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

37/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

tryacatch(exn)...

C#,C++,Java,JavaScript

trya
...
catchexn
...

CoffeeScript

try{...}catch(t$v){...}

PHP5

tryacatchexnthen...end

Oz

tryacatchexn:...endtry

Maple

try(a);catch(...)

Io

try{aCATCHexn{...}}

Perl6

TRYaEXCEPTexn=>...END

Modula3

ahandleexn=>...

SML

aon:exception_namedo:[:exn|...]

Smalltalk

ifCurtailed

Smalltalk

rescue

Eiffel,Ruby

eval{a};if($@)...

Perl

exceptionwhenexception_name=>

Ada

catcha(\exn>...)

Haskell

catch

Erlang,Forth,Logo,Prolog,Rebol,Tcl

Catch

Mathematica

catch/name

Rebol

catch(...)orcatch{...};

Pike

if(catch(exn)){...}a

Yorick

pcall

Lua

withexceptionhandlerorguard

SchemeSRFI34

blockaexception(exn)...end

Dylan

?,shy,safe

Pliant

handlerbindhandlercaseignoreerrors

CommonLisp

NS_DURINGaNS_HANDLER...NS_ENDHANDLER

ObjectiveC

try
a
catch
...
end

Matlab

signalonpredefined_condition_name
...
predefined_condition_name:
...

ClassicREXX

cleanup:codeexecutedbeforeleaving
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

38/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

ensure

Ruby,Smalltalk

finally

C#,F#,Java,Maple,Python

FINALLY

Modula3

unwindprotect

CommonLisp,EmacsLisp

cleanup

Dylan

dynamicwind

Scheme

retrying:aftercatchinganexception,tellthesnippettobererun
retry

Eiffel,Ruby,Smalltalk

restart

Dylan

resumeexecutionwheretheexceptiontookplace
resume

Smalltalk

callwithcurrentcontinuation
callwithcurrentcontinuation(50)

Scheme

callcc

Ruby,SMLNJ

Types
declaration
typedeftn

C,C++,Pike

typenist

Ada

typen...

Pliant

typen=t

F#,Haskell,OCaml,Pascal,SML

TYPEn=t

Modula3

usingn=...

C#

datan=t

Haskell

datatypen=t

SML

newtypen=t

Haskell

n=t

merd,Python

n:t

Beta

(deftypen()'t)

CommonLisp

annotation(orvariabledeclaration)
:

Ada,E,Eiffel,F#,Modula3,OCaml,Pascal,SML

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

39/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

::

Dylan,Haskell,Mercury

!!

merd

tv

C,C#,C++,Java,Perl6,Pike,Pliant,YCP

(declare(tv))

CommonLisp

v:@t

Beta

_t(51)

Mathematica

cast
upcast
(t)e

C,C#,C++,Java,PHP

t(e)

Ada,Pascal

[t]e

Pike

static_cast<t>(e)

C++

e:>t

OCaml

e:t

F#

upcaste

F#

CAST(east)

SQL92

typecast(e,t)

Matlab

downcast(needruntimechecking)
(t)e

Java

t(e)

Ada

e:t

[t]e

Pike

dynamic_cast<t>(e)

C++

east

C#

e:?>t

F#

downcaste(52)

F#

v?=e(53)

Eiffel

NARROW(e,t)

Modula3

typecast(e,t)

Matlab

computedconversion(callsaninternalorauserdefinedfunction)
(t)e

C++,Pike

[t]e

MSH

t(e)

C++,Matlab,Python

te
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

40/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

F#
e:t

e::t

Haskell

castet

Pliant

...castt

Pliant

makete/tote

Rebol

mutability,constness
typeofamutablevalue
mutabilityisthedefault

C,C#,C++,Java,Matlab

valx:T

Pascal

Tref

F#,OCaml,SML

STRefaT

Haskell

inoutT(54)

Ada

typeofaconstantvalue
constT

C++,C99

constantT

Ada

constx:T

Pascal

constnessisthedefault

F#,Haskell,OCaml,SML

specialcases
"readonly"fields(55)

C#

"final"fields,parameters,localvariables(55)

Java

ObjectOriented&Reflexivity
methodinvocation

object.method(para)

Ada,Beta,C#,C++,Cecil,CoffeeScript,DelphiKylix,E,Eiffel,F#,Icon,
Java,JavaScript,merd,Modula3,MSH,Perl6,Python,Ruby,Sather,Visual
Basic

object#methodpara

OCaml

object:method(para)

Lua

objectmethod(para)

Io

objectmethodpara

Pliant,Tcl

objectmethod:para1
method_continuation:
para2

Smalltalk

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

41/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

object<method(para)
(56)

[objectmethod:para
]

ObjectiveC

object>method(para)

C++,Perl,PHP,Pike

object["method"](para)

Pike

object/methodpara

Rebol

methodobjectpara

Haskell,Mercury

(methodobjectpara)

CommonLisp

method(object,para)

Ada,Dylan,Matlab

para>method

Beta

(sendobjectmethod
para)

MzScheme

withnoparameter
object.method

Ada,Eiffel,F#,merd,Perl6,Ruby

object.property(57)

C#

object.method()

C#,C++,CoffeeScript,E,Java,JavaScript,Python

object#method

OCaml

object:method

Pliant

object>method

Perl

object>method()

PHP5,Pike

object/method

Rebol

object["method"]()

Pike

objectmethod

Io,Smalltalk

[objectmethod]

ObjectiveC

methodobject

Haskell,Mercury

(methodobject)

CommonLisp

method(object)

Ada,Dylan,Matlab

(sendobjectmethod)

MzScheme

objectcreation
new

PHP,Pliant,Simula

newclass_name(...)

C#,C++,CoffeeScript,F#,Java,JavaScript,Perl,PHP,Visual
Basic

newclass_name...

CoffeeScript,OCaml

class_name.new(...)

Perl6,Ruby

class_namenew

Smalltalk

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

42/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

class_name(...)

F#,Matlab,Pike,Python

class_namev(...)

C++

v:class_name

Ada

class_name.Create

DelphiKylix

!class_name!constructor_name(...)

Eiffel

&

Beta

makeobject

MzScheme

(makeinstanceclass_name...)

CommonLisp

[class_namealloc]

ObjectiveC

makeclass_name!...

Rebol

defobject_name{...}

objectcloning
o.clone

Perl6

o.clone(58)

Eiffel,Ruby

o.deep_clone

Eiffel

o.clone()

Java

o.Clone()

C#

clone$o

PHP5

oclone

Io

clone/copyordeepCopy

Smalltalk

Storable::dclone

Perl

[ocopy]

ObjectiveC

copy.copy(o)(59)

Python

purecopy

EmacsLisp

{<>}orOo.copyo

OCaml

o2=o(60)

C++,Matlab,PHP

$o2=$o

PHP

o2.all:=o.all

Ada

makeo[]

Rebol

o_:T'Class:=o(61)

Ada

manuallycallanobject'sdestructor
delete

C++,JavaScript

destroy

Pike

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

43/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

DESTROY

Perl

dealloc

ObjectiveC

Dispose

C#,F#

del,__del__

Python

__destruct

PHP5

RequiresinstantiationofAda.Unchecked_Deallocation

Ada

classdeclaration
class

C#,C++,CoffeeScript,Haskell,Java,Matlab,MzScheme,
OCaml,Perl6,PHP,Pike,Python,Ruby

classcinheritp1p2...feature
decldecl...end

Eiffel

defclassdefstruct

CommonLisp

subclass

Smalltalk

struct

C++

type

Pliant

typecistaggedrecord...end
record(62)

Ada

@interfacec{...}...@end

ObjectiveC

Beta

typec()=class...end

F#

typec()=
...

F#

testingclassmembership
isa

Matlab,Perl

is_a?kind_of?

Ruby

o.meta.isa

Perl6

isKindOf(63)

Smalltalk

isKindOfClass

ObjectiveC

dynamic_cast

C++

instanceof

CoffeeScript,Java,JavaScript,PHP5

isinstance

Python

in

Ada

is

C#

is_a

PHP

:?

F#

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

44/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Program.inheritsorProgram.implements

Pike

entry_type

Pliant

typep

CommonLisp

ISTYPE

Modula3

object##<classname##

Beta

type.accepts(object)/object=~v:type

var?=val(64)

Eiffel

getthetype/classcorrespondingtoanobject/instance/value
class

Matlab,ObjectiveC,Ruby,Smalltalk

__class__

Python

getClass

Java

get_class

PHP

GetType

F#

typeid

C++

typeof

C#,CoffeeScript,JavaScript

typeof

CommonLisp

type

Io

ref

Perl

generator

Eiffel

meta

Perl6

object_program

Pike

getAllegedType

methodsavailable
methods

Matlab,Ruby

get_class_methods

PHP

getMethods

Java

getmember

MSH

indices

Pike

o.meta.getmethods

Perl6

dir

Python

slotNames

Io

o.GetType().GetMethods()

F#

oclassselectors/oclassallSelectors

Smalltalk

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

45/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

o.__getAllegedType().getMessageTypes()

inheritance
child:<parent

Beta

classchild:parent

C#,C++

classchild<parentend

Ruby

classchildisparent{...}

Perl6

classchildextendsparent

CoffeeScript,Java,PHP5

classchild(parent):

Python

classchildinheritparentend

Eiffel

parentsubclass:child

Smalltalk

makeparent...

Rebol

inherit

OCaml,Pike

defchildextendsmakeSuperObject(parent,...){...}

typechildisnewparentwithrecord...endrecord

Ada

typechild=
inheritparent
...

F#

(defclasschild(parent)...)

CommonLisp

@interfacechild:parent{...}...@end

ObjectiveC

@ISA=qw(parent1parent2)

Perl

clone,setProtos,setProto,prependProto,appendProto

Io

instanceParentChildwhere...

Haskell

hasthemethod
can

Perl,Perl6

respond_to?

Ruby

respondsTo

E,Smalltalk

respondsToSelector

ObjectiveC

hasattr(obj,"meth")(65)

Python

object>method

Pike

all[inobject'methodfunction?getinobject'method]

Rebol

findmethod

CommonLisp

ismethod

Matlab

hasSlot

Io

tryobj.GetType().GetMethod("meth")with...

F#

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

46/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

obj.meth?instanceofFunction

CoffeeScript

method_exists

PHP5

currentinstance
this

Beta,C#,C++,CoffeeScript,Java,JavaScript,PHP,
Pike

THIS

Simula

self

Io,ObjectiveC,Rebol,Ruby,Smalltalk

object_nameifdefinedas:defobject_name{
...}

Current

Eiffel

firstparameter(66)

Matlab,Perl,Pliant,Python

theobjectvariable

F#

dispatchingparameter

Ada,CommonLisp

Me

VisualBasic

Perl6

accessingparentmethod
super

CoffeeScript,E,Java,ObjectiveC,Ruby,Smalltalk

super(Class,self).meth(args)

Python

base

C#

resend

Io

Precursor

Eiffel

$o.SUPER::method(...)

Perl6

$o>SUPER::method(...)

Perl

method(parent(dispatchingparameter))

Ada

parent(dispatchingparameter).method

Ada

parent::method

PHP5

callnextmethod

CommonLisp

typefoo2=
inheritfooasparent
...
member...=...parent.meth

F#

accessingchildmethod
inner

Beta

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

47/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Package,Module
packagescope
.

Ada,C#,CoffeeScript,E,F#,Haskell,Java,Modula3,OCaml,Pascal,Python,Ruby,SML,
Squeak

XML

::

C++,merd,Perl,Ruby,Squeak,Tcl,YCP

:::
(67)

CommonLisp

Maple

'

Perl

Mathematica

__

Mercury

Matlab

declare
packagep;

Java,Perl

namespacep{...}

C#,C++

namespacep...

F#

namespaceP;

PHP5

namespaceevalp...

Tcl

modulepwhere...

Haskell

moduleP...end

Ruby

moduleP=struct...end

OCaml

{module"p";...}

YCP

:module(p)

Prolog

p=module()...endmodule

Maple

(defpackagep...)

CommonLisp

automaticallydonebasedonthefilename

OCaml,Python,Tcl8.5

packagedeclare(68)

Matlab

Begin["p`"]...End[]

Mathematica

BeginPackage["p`"]...EndPackage[]

Mathematica

<nodexmlns="namespace">...</node>

XML

packagepis
Declarepublicpackagemembershere
private
Declareprivatepackagemembershere
endp;
Ada
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

48/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

packagebodypis
...Definepackageimplementationhere
endp;

selectiveexport
modulep(name1,name2,...)where...

Haskell

@ISA=qw(Exporter);@EXPORT=qw(name1name2...);

Perl

packagepis...end;packagebodypis...end;

Ada

p=module()exportname1,name2,...;...endmodule

Maple

(export'name1'name2)

Common
Lisp

attachedtoeachname(public,private...)

Java,
Pike

namespaceexportname1

Tcl

namespacep
valname1:type1
...

F#

append_features

Ruby

moduletypePType=sigvalname1:type1...end
moduleP:PType=struct...end

OCaml

allfilesinpackagedirectoryareexported.filesin/privatesubdirectoryare
notexported,butcanbeusedbythepackageitself

Matlab

__all__=[...]

Python

import
everythingintocurrentnamespace
usep(69)

Perl

usesp

Pascal

usingp

C#

usingnamespacep;

C++

(usepackage'p)

CommonLisp

openp

F#,OCaml

import

Pike

importp

Haskell

IMPORTp;

Modula2

importp.*

Java

import"p"

YCP

frompimport*

Python

withp;usep;

Ada

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

49/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

namespaceimportp*

Tcl

inheritcexport{NONE}allend

Eiffel

includeorevenextend

Ruby

do

Rebol

addpath

Matlab

.p

BourneShell

sourcep

BourneShell

builtinf/path/to/lib.so

KornShell

<<p`

Mathematica

Get["p`"]

Mathematica

Needs["p`"]

Mathematica

useP1\P;

PHP5

useP1\PasQ;

PHP5

selectively
importp(name1,name2,...)

Haskell

importp.name1;importp.name2

Java

(import'(p:name1p:name2))

CommonLisp

usepqw(name1name2...)

Perl

frompimportname1,name2,...

Python

FROMpIMPORTname1,name2,...;

Modula2

namespaceimportpname1

Tcl

usingp::name1;usingp::name2;...

C++

withp;usetypep.type1;...

Ada

with(p[name1,name2,])

Maple

defname:=<import:p.name>

:use_module(name1,name2,...)

Prolog

package(ie.loadthepackage)
importp

Python

usep;(70)

Perl

requirep

Perl

require"p"

Ruby

require,"p"

Yorick

(require'p)(71)

CommonLisp

withp;

Ada

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

50/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

with(p)

Maple

packagerequirep

Tcl

automaticallydone(72)

Java,OCaml

Strings
typename
char[]

charconst[]

C++

string

C#,C++,F#,Maple,OCaml,Pascal,PHP,Pike,SML,YCP

string!

Rebol

String

Ada,C#,CoffeeScript,Haskell,Java,JavaScript,merd,Ruby,Smalltalk,Visual
Basic

STRING

Eiffel

str

Python,YAML

Str

Perl6,Pliant

NSString*

ObjectiveC

CHAR,
VARCHAR(size)

SQL92

Sequence

Io

charactertypename
char

C,C#,C++,F#,OCaml,SML

char!

Rebol

Char

Haskell,merd,Perl6

Character

Ada,Smalltalk

CHARACTER

Eiffel

character"z"
'z'

Ada,B,C,C#,C++,ClassicREXX,E,Eiffel,F#,Haskell,Matlab,OCaml,
Pascal,Pike

"z"

BourneShell,ClassicREXX,Maple,merd

"z

Logo

$z

Smalltalk

#\z

CommonLisp,Scheme

#"z"

Rebol,SML

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

51/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

&z

Oz

?z

EmacsLisp,Ruby

charz,[char]
z(73)

Forth

strings
withnointerpolationofvariables
'...'

Beta,BourneShell,ClassicREXX,CoffeeScript,CSS,FishShell,JavaScript,Lua,
Matlab,Pascal,Perl,Perl6,PHP,Prolog,Python,Ruby,Smalltalk,SQL92,XPath,
YAML

"..."

Ada,Awk,C,C#,C++,ClassicREXX,CommonLisp,CSS,Dylan,E,Eiffel,Emacs
Lisp,F#,FL,Haskell,Io,Java,JavaScript,Lua,Maple,Mathematica,Modula3,
MUMPS,OCaml,Oz,Pike,Pliant,Prolog,Python,Rebol,Scheme,SML,XPath,
YAML,YCP

"...

Logo

'''...'''

Python

"""..."""

Io,Python

[[...]]

Lua

R"[...]"

C++0x

<<'MARK'...
MARK

BourneShell,Perl,Ruby

<<<'MARK'...
MARK(74)

PHP5

{...{...}...}

Tcl

(...)

PostScript

q(...(...)...),
q[...],q{...},
q<...>,q/.../

Perl,Perl6

%q(...
(...)...),
%q[...],
%q{...},
%q<...>,
%q/.../

Ruby

q(...(...)...)

merd

@"...""..."

C#

s"..."

Forth

@"..."

ObjectiveC

withinterpolationofvariables
...(75)

Tcl

"...$v..."

BourneShell,FishShell,Perl,Perl6,PHP,
Tcl

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

52/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

"...{v}..."

merd

"...#{v}...""...#$v...""...#@v...""...#@@v
..."

CoffeeScript,Ruby

<<MARK...$v...MARK

BourneShell,Perl

<<MARK...#{v}...MARK

Ruby

<<<MARK...$v...MARK

PHP

qq(...(...$v...)...),qq[...],qq{...},qq<...>,
qq/.../

Perl,Perl6

%Q(...(...#{v}...)...),%Q[...],%Q{...},%Q<...>,
%Q/.../

Ruby

qq(...(...{v}...)...)

merd

"...#{v}..."interpolate

Io

"...%(v)s..."%vars()

Python

endofline(withoutwritingtherealCRorLFcharacter)
\n

Tcl

"\n"

C,C#,C++,CoffeeScript,FishShell,Haskell,Io,Java,JavaScript,Lua,Maple,Mathematica,
OCaml,Perl,Perl6,PHP,Pike,Python,Ruby,YCP,Yorick

"*n"

B,BCPL

"%N"

Eiffel

"^/"

Rebol

"~%"(76)

CommonLisp

"[lf]"

Pliant

vb_nl

VisualBasic

<N>(77)

Smalltalk

multiline
allstringsallow
multilinestrings

BourneShell,CommonLisp,E,EmacsLisp,F#,FishShell,Io,Maple,
Mathematica,OCaml,Pascal,Perl,Perl6,PHP,Ruby,Scheme,Smalltalk,YCP

"...",{...}

Tcl

@"..."

C#

'''...''',
"""..."""

Python

[[...]]

Lua

{...}

Rebol

"...\n"
"...\n"

..."...\n\
\...\n"

Haskell

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

53/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

"...",
"..."

ClassicREXX

"...%N%
%...%N"

Eiffel

"""..."""

CoffeeScript

convertsomethingtoastring(seealsostringinterpolation)
show

Haskell

to_s,to_str,inspect,String()

Ruby

to_string

merd,Pliant

tostring

Lua,YCP

toString

CoffeeScript,Java,JavaScript

ToString

C#,F#,Mathematica

String

CoffeeScript,JavaScript

perl

Perl6

Dumper

Perl

"".e

Perl

""~e

Perl6

""+e

CoffeeScript,E,Java,JavaScript

string

Pliant

str,`e`,repr

Python

out

Eiffel

cvs

PostScript

T'Image(e)(78)

Ada

asString

Io,Smalltalk

printString

Smalltalk

as(<string>,e)

Dylan

(string)e

PHP,Pike

convert(e,string)

Maple

(coercee'string)

CommonLisp

prin1tostring

EmacsLisp

tostring!/tostring/to""

Rebol

description

ObjectiveC

pr1

Yorick

unneeded,allvaluesarestrings

Tcl

serialize(marshalling)
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

54/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

exportclixml

MSH

serialize

Io,PHP

Marshal.to_string

OCaml

Marshal.dump

Ruby

Data.Binary.encode

Haskell

BinaryFormatter.Serialize

F#

storeBinaryOn

Smalltalk

Storable::store

Perl

pickle.dump(79)

Python

(withstandardiosyntax(writeobjstream))

CommonLisp

T'Output(78)

Ada

unserialize(unmarshalling)
importclixml

MSH

unserialize

PHP

Marshal.from_string

OCaml

Marshal.load

Ruby

Data.Binary.decode

Haskell

BinaryFormatter.Deserialize

F#

readBinaryFrom

Smalltalk

pickle.load

Python

(withstandardiosyntax(readobjstream))

CommonLisp

Storable::store

Perl

doString

Io

T'Input(78)

Ada

sprintflike
sprintf

Awk,C,C++,F#,Maple,Matlab,merd,OCaml,Perl,Perl6,PHP,Pike,Ruby

printf

Haskell

Python,Ruby

format

Java,Lua,Tcl

format(80)

CommonLisp,Erlang,SchemeSRFI28

Format

C#,F#

putFormat

Beta

stringWithFormat

ObjectiveC

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

55/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

expandMacrosWith(80)

Smalltalk

Storable::retrieve

Perl

simpleprint
onstrings
puts

C,Dylan,Tcl

print

Awk,Basic,Java,Maple,merd,PHP,SML

write

JavaScript,Pascal,Pike,Yorick

putStr

Haskell

print_string

F#,OCaml

console

Pliant

writeln

JavaScript,Pascal

writestring

CommonLisp

putStrLn

Haskell

Put_Line

Ada

display

Cobol

message

EmacsLisp

put_string

Eiffel

show

Smalltalk

print_endline(81)

OCaml

println(81)

Java,merd

put_chars

Erlang

echo(82)

BourneShell,FishShell,PHP

type

Forth

putText

Beta

say

ClassicREXX

pori

GNUsed

onsimpleobjects
print

Perl,Perl6

say(81)

Perl6

puts(81)

Tcl

putsnonewline

Tcl

onanyobjects
print
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

Io,Logo,Lua,Ruby
56/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

print(81)

Dylan,Haskell,Python,
Rebol

Print

Mathematica

printe,

Python

println(81)

Io

prin

Rebol

Put

Ada

p(81)

Ruby

puts(83)

Ruby

display

Scheme

write

CommonLisp,Io,Prolog,
Scheme

writeln(81)

Io

print

CommonLisp

printOn

Smalltalk

princprin1

CommonLisp,EmacsLisp

print_any

F#

WriteLine

C#,F#

nothingjustremove";"attheendoftheexpression,andit
willprintit

Matlab

disp

Matlab

printflike
printf

Awk,C,C++,F#,Haskell,KornShell,Maple,Matlab,merd,OCaml,Perl,PHP,Ruby

write

Pike

WriteLine

C#

putFormat

Beta

format(80)

CommonLisp,Prolog

stringequality&inequality
eqne

Perl,Perl6,Tcl

strcmp

C,Matlab

==!=

CoffeeScript,JavaScript,Pike

==!==

PHP

==~=

Lua

=\=

Prolog

isEqualToString(84)

ObjectiveC

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

57/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

==!=

Awk,C#,C++,E,Io,merd,Python,Ruby,YCP

==<>

Python

==/=

Haskell

==\=

Oz

=!=

BourneShell,FishShell,Maple,XPath

=/=

Ada

=\=

ClassicREXX

=<>

Beta,F#,OCaml,Pliant,SML,VisualBasic

=~=

Dylan,Smalltalk

==\==or=<>\=

ClassicREXX

====!=/==!=(19)

Mathematica

==~=

Matlab

equal?

Ruby,Scheme

equals

Java

equal,equalp

CommonLisp

is_equal

Eiffel

isEqual

ObjectiveC

stringsize
length

Awk,Beta,C++,CoffeeScript,CommonLisp,Eiffel,F#,Haskell,Java,JavaScript,
Maple,Matlab,ObjectiveC,OCaml,Perl,PostScript,Prolog,Ruby

LENGTH

ClassicREXX

'Length

Ada

length?

Rebol

size

C++,E,Io,Ruby,Smalltalk,SML,YCP

Length

C#,F#,Modula3,Oz,Pascal

len

Pliant,Python,VisualBasic

strlen

C,PHP

stringlength

Tcl

stringlength

Scheme,XPath

StringLength

Mathematica

sizeof

Pike

count

Eiffel,Logo

byteschars

Perl6

CHARACTER_LENGTH

SQL92

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

58/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

atom_length

Prolog

wcc

FishShell

Lua

${#v}

BourneShell

dup(85)

Forth

stringconcatenation
+

C#,C++,CoffeeScript,E,Eiffel,F#,Java,JavaScript,merd,MSH,Pascal,
Pike,Pliant,Python,Ruby,YCP

Perl,PHP

..

Io,Lua

Smalltalk

Perl6

&

Ada,Modula3,VisualBasic

F#,OCaml,SML

MUMPS

||

Cecil,ClassicREXX,Icon,Maple,PL/I,SQL92

++

Haskell

$a$b

BourneShell,FishShell,Tcl

concatenate

CommonLisp,Dylan

stringappend

Scheme

StringJoin

Mathematica

cat

Maple

Cat

Modula3

strcat

concat

XPath

append

Beta,Prolog,Rebol

stringByAppendingString

ObjectiveC
Awk,ClassicREXX

[string1string2]

Matlab

word

Logo

duplicatentimes
*

Ada,E,Pike,Python,Ruby

Perl,Perl6

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

59/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

times

merd

repeat

Pliant

repeated

Io

str_repeat

PHP

stringrepeat

Tcl

strrep

Lua

repmat

Matlab

insert/dup

Rebol

COPIES

ClassicREXX

cat(s$n)

Maple

concat$replicate

Haskell

upper/lowercasecharacter
upcase/downcase

EmacsLisp,Ruby

uc/lc

Perl,Perl6

upper/lower(86)

Lua,Matlab,Pliant,Python

toUpper/toLower

Haskell

to_upper/to_lower

Eiffel

To_Upper/To_Lower

Ada

toUpperCase/toLowerCase

CoffeeScript,E,Java,JavaScript

upper_case/lower_case

Pike

uppercase/lowercase

F#,Logo,OCaml

strupper/strlower

Lua

strtoupper/strtolower

PHP

ToUpper/ToLower

C#,F#,Oz

toupper/tolower

Awk,C,C++

stringtoupper/stringtolower

Tcl

asLowercase/asUppercase

Io,Smalltalk

upCase/lowCase

Beta

uppercaseform/lowercaseform

Rebol

charupcase/chardowncase

CommonLisp,Scheme

char_type(C_,to_upper(C)),char_type(C_,to_lower(C))

Prolog

\U/\L/\C

GNUsed

uppercase/lowercase/capitalizedstring
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

60/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

upcase/downcase

EmacsLisp,Ruby

upper/lower

Matlab,SQL92

upper/lower/capitalize

Python

uppercase/lowercase

F#,Logo,OCaml,Rebol

upcase_atom/downcase_atom

Prolog

toUpperCase/toLowerCase

CoffeeScript,E,Java,
JavaScript

ToUpperCase/ToLowerCase

Mathematica

ToUpper/ToLower

C#,F#

to_upper/to_lower

Ada,Eiffel

toupper/tolower

Awk,YCP

uc/lc

Perl,Perl6

UpperCase/LowerCase

Pascal

StringTools[UpperCase]/StringTools[LowerCase]/
StringTools[Capitalize]

Maple

uppercaseString/lowercaseString/capitalizedString

ObjectiveC

UCase/LCase

VisualBasic

strtoupper/strtolower

PHP,Yorick

strupper/strlower

Lua

stringtoupper/stringtolower/stringtotitle

Tcl

stringupcase/stringdowncase

CommonLisp,Scheme

asLowercase/asUppercase/asUppercaseFirst

Smalltalk

asLowercase/asUppercase/makeFirstCharacterUppercase

Io

upcase_atom/downcase_atom

Prolog

makeLC/makeUC

Beta

parseuppervarin_varout_var/parselowervarin_varout_var

ClassicREXX

asciitocharacter
chr

F#,Haskell,OCaml,Pascal,Perl,Perl6,PHP,Python,Ruby,SML

chr$

VisualBasic

char

Matlab

format%c$c

Tcl

toChar

strchar

Lua

from_integer

Eiffel

fromCharCode

CoffeeScript,JavaScript

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

61/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

FromCharacterCode

Mathematica

character

Pliant

Charactervalue:c

Smalltalk

asCharacter

Io

codechar

CommonLisp

integer>char

Scheme

'Val

Ada

(char)c

C,C#,C++,Java

tochar!/tochar

Rebol

X2C,D2C

ClassicREXX

$CHAR(s)

MUMPS

char_code

Prolog

ascii

Logo

StringTools[Char]

Maple

charactertoascii
ord

F#,Haskell,Pascal,Perl,Perl6,PHP,
Python,SML

asc

VisualBasic

getNumericValue

Java

charCodeAt

CoffeeScript,JavaScript

asciiValue

Smalltalk

code

Eiffel,OCaml

charcode

CommonLisp

char>integer

Scheme

s[0]

Ruby

s0get

PostScript

sat(0)

Io

scan$s%c

Tcl

strbyte

Lua

toInteger

'Pos

Ada

number

Pliant

(int)c

C,C#,C++,Java

tointeger!/tointeger

Rebol

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

62/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

ToCharacterCode

Mathematica

C2X,C2D

ClassicREXX

$ASCII(s)

MUMPS

(doneautomaticallywhenapplyingmathematicaloperations
onchar,suchas+)

Matlab

char

Logo

char_code

Prolog

StringTools[Ord]

Maple

accessingnthcharacter
s[n]

C,C#,C++,E,Maple,PHP,Pike,Python,Ruby

s(n)

Ada,Matlab

s:n

Pliant

s.[n]

F#,OCaml

s!!n

Haskell

s@n

Eiffel

s/:n

Rebol

stringindexsn

Tcl

sub

SML

char,aref,schar,svref

CommonLisp

GetChar

Modula3

sat(n)

Io

at(87)

C++,Smalltalk

aref

CommonLisp

char(s,i)

charAt

CoffeeScript,Java,JavaScript

characterAtIndex

ObjectiveC

n>s.inxGet

Beta

stringref

Scheme

StringTake[s,{n}]

Mathematica

$EXTRACT(s,n)

MUMPS

item

Logo

overnchars+c@

Forth

s/.{n}(.).*/\1/

GNUsed

extractasubstring
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

63/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

s[n..m]

CoffeeScript,Maple,Pike,Ruby

s.[n..m]

F#

s(n..m)

Ada

s(n:m)

Matlab

s(n,m+1)

s[n:m+1]

Python

s[n,len]

Ruby

snlen

Pliant

strndup(s+n,len)

substring

Eiffel,Java,Scheme,SML,XPath,YCP

Substring

C#

substr

C++,Perl,Perl6,PHP

SUBSTR

ClassicREXX

sub

F#,Lua,OCaml

SUB

Modula3

subseq

CommonLisp

slice

CoffeeScript,Io,JavaScript

mid$

JavaScript

stringrange

Tcl

StringTake[s,{n,m}]

Mathematica

strpart(s,n,m)

Yorick

copy/partatsnlen

Rebol

copy/partatsnatsm

Rebol

scopyFrom:nto:m

Smalltalk

(n,m)>s.sub

Beta

[ssubstringWithRange:NSMakeRange(n,len)]

ObjectiveC

SUBSTRING(sFROMnlen)

SQL92

$EXTRACT(s,n,m)

MUMPS

sub_string/sub_atom

Prolog

(takelen.dropn)s

Haskell

overnchars+len

Forth

s/.{n}(.{len}).*/\1/

GNUsed

locateasubstring
index

Ada,Perl,Perl6,Python,Ruby

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

64/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

indexOf

CoffeeScript,Java,JavaScript

IndexOf

C#,F#

indexOfString

Smalltalk

startOf

search

CommonLisp,Pike,PostScript

StringTools[Search]

Maple

StringPosition

Mathematica

strstrstrchr

find

C++,Logo,Lua,Python,Rebol,YCP

findSeq

Io

findSubstring

Haskell

strfind

Matlab,Yorick

strpos

PHP

$FIND

MUMPS

index_non_blank/find_token

Ada

substring_index

Eiffel

rangeOfString

ObjectiveC

POS

ClassicREXX

POSITION(needleINs)

SQL92

sub_string/sub_atom

Prolog

stringfirst

Tcl

locateasubstring(startingattheend)
rindex

OCaml,Perl,Perl6,Python,Ruby

rfind

C++,Python

find/last

Rebol

strrchr

index(Going=>Backward)

Ada

lastStartOf

lastIndexOf

CoffeeScript,Java,JavaScript

last_index_of(88)

Eiffel

LastIndexOf

C#,F#

lastIndexOfString

Smalltalk

stringlast

Tcl

(searchsubstringstring:fromendt)

CommonLisp

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

65/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

[stringrangeOfString:substringoptions:NSBackwardsSearch]

ObjectiveC

LASTPOS

ClassicREXX

t=strfind(s,p),t(end)

Matlab

strrpos

PHP

StringTools[SearchAll](s,p)[1]

Maple

Booleans
typename
Bool

Haskell,Perl6,Pliant

bool

C#,C++,C99,F#,OCaml,PHP,Python,SML,YAML

Boolean

Ada,Lua,Pascal,Smalltalk,VisualBasic

boolean

CoffeeScript,CommonLisp,Java,JavaScript,Maple,PHP,YCP

BOOLEAN

Eiffel

logic!

Rebol

logical

Matlab

falsevalue

false

Ada,BCPL,Beta,BourneShell,C#,C++,C99,CoffeeScript,E,F#,FL,Forth,Io,
Java,JavaScript,Logo,Lua,Maple,Matlab,OCaml,Oz,Pascal,PHP,Pliant,
PostScript,Rebol,Ruby,Smalltalk,SML,Tcl,YAML,YCP

False

Eiffel,Haskell,Mathematica,merd,Python,VisualBasic

FALSE

Modula3,SQL92

false()

XPath

#f

Dylan,Scheme

YAML

nil

CommonLisp,EmacsLisp,Io,Lua,Ruby

no

CoffeeScript,Tcl,YAML

No

Prolog

none

Rebol

None

Python

null

CoffeeScript,JavaScript

NULL

C,C++,C99,PHP

off

CoffeeScript,Tcl,YAML

undef

Perl,Perl6

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

66/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

undefined

CoffeeScript,JavaScript

fail

Prolog

FAIL

Maple

array
containingat
leastonefalse
value

Matlab

exitstatus
differentfrom
0

BourneShell

0(89)

Awk,B,C,C++,C99,ClassicREXX,CoffeeScript,Forth,JavaScript,Matlab,
MUMPS,Perl,Perl6,PHP,Pike,Python,Tcl,VisualBasic,XPath,Yorick

0.0

Matlab,Perl,PHP

NaN

CoffeeScript,JavaScript,XPath

""

Awk,CoffeeScript,JavaScript,Perl,Perl6,PHP,Python,XPath

"0"

Awk,Perl,Perl6,PHP

''

CoffeeScript,Matlab,Perl

'\0'

C,C++,C99

()

Perl,Perl6,Python

[]

Matlab,Python

{}

Matlab,Python

array()

PHP

truevalue
TRUE

Modula3,SQL92

True

Eiffel,Haskell,Mathematica,merd,Python,VisualBasic

true

Ada,BCPL,Beta,BourneShell,C#,C++,CoffeeScript,E,F#,FL,Forth,Io,Java,
JavaScript,Logo,Maple,OCaml,Oz,Pascal,PHP,Pliant,PostScript,Prolog,Rebol,Ruby,
Smalltalk,SML,Tcl,YAML,YCP

true()

XPath

CommonLisp,EmacsLisp

#t

Dylan,Scheme

YAML

yes

CoffeeScript,Tcl,YAML

Yes

Prolog

on

CoffeeScript,Tcl,YAML

exit
status0

BourneShell

anything
not

Awk,B,C,C++,CommonLisp,Dylan,EmacsLisp,Matlab,MUMPS,Perl,Perl6,Pike,

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

67/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

false

Python,Rebol,Ruby,Scheme,XPath,Yorick

ClassicREXX,MUMPS

nonzero
number

Tcl

non
zero
numbers

VisualBasic

Forth

logicalnot
!

Awk,B,C,C#,C++,CoffeeScript,E,Java,JavaScript,Mathematica,Perl,Perl6,PHP,Pike,
Ruby,Tcl,YCP,Yorick

not(90)

Ada,Beta,CoffeeScript,CommonLisp,Eiffel,EmacsLisp,F#,Haskell,Io,Logo,Lua,
Maple,merd,OCaml,Pascal,Perl,Perl6,Pliant,PostScript,Prolog,Python,Rebol,Ruby,
Scheme,Smalltalk,SML,XPath

Not

Oz,VisualBasic

NOT

Modula3

BCPL,Dylan,Matlab,PL/I

PL/I

'

MUMPS

ClassicREXX

=0

Forth

logicalor/and
shortcircuit
||/&&

Awk,C,C#,C++,CoffeeScript,E,F#,Haskell,Java,JavaScript,Mathematica,Matlab,
merd,OCaml,Perl,Perl6,PHP,Pike,Ruby,Tcl,YCP,Yorick

|/&

B,BCPL,Dylan

or/and

CoffeeScript,CommonLisp,EmacsLisp,Io,Logo,Lua,Modula2,Perl,Perl6,PHP,
Pliant,Python,Ruby,Scheme,Smalltalk

OR/AND

Modula3

or/&(91)

Modula2

any/all

Rebol

orelse/
andalso

SML

orelse/
andthen

Oz

orelse/
andthen

Ada,Eiffel

;/,

Prolog

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

68/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

&/!

MUMPS

nonshortcircuit(alwaysevaluatesbotharguments)
|/&

C#,ClassicREXX,Java,Matlab,Smalltalk

or/and

Ada,Beta,Eiffel,Maple,Pascal,PostScript,Rebol,SML,XPath

Or/And(92)

Oz,VisualBasic

\///\(14)

BCPL

?|/

Perl6

BagsandLists
typename
seq

YAML

alist

F#,OCaml,SML

[a]

Haskell

a[]

C#

list

Maple,Python

List

Io,Mathematica,Pliant

ArrayorList

Perl6

ARRAYorLINKED_LIST

Eiffel

ArrayorOrderedCollection

Smalltalk

ARRAY

Perl

array

PHP

cell

Matlab

vector

C++

Containers.Vectors.VectororAda.Containers.Doubly_Linked_Lists.List

Ada

listconcatenation
+

E,Eiffel,merd,PHP,Pike,Python,Ruby

Maple,Matlab,Perl,Smalltalk

F#,OCaml,SML

&

Ada

++

Haskell

|||

Icon

array_merge

PHP

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

69/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

merge

YCP

concat

CoffeeScript,JavaScript,Tcl

concatenate

Dylan

nconc

CommonLisp,EmacsLisp

append

Beta,CommonLisp,EmacsLisp,Prolog,Rebol,Scheme

Append

Oz

appendSeq

Io

arrayByAddingObjectsFromArray

ObjectiveC

sentence

Logo

Join

Mathematica

listflattening
oneleveldepth
concat

F#,Haskell,Mercury,SML

flatten

F#,Io,merd,OCaml,Prolog,YCP

Flatten

Oz

evalconcat

Tcl

ListTools[FlattenOnce]

Maple

{*}$l

Tcl8.5

"$l"

FishShell

recursive
flatten

Pike,Ruby

ListTools[Flatten]

Maple

Flatten

Mathematica

listconstructor
[a,b,c](93)

CoffeeScript,E,Haskell,JavaScript,Maple,Matlab,merd,Perl,Perl6,
PHP5,PostScript,Prolog,Python,Ruby,SML,YAML,YCP

(a,b,c)

Perl,Perl6

{a,b,c}(94)

C,C++,Lua,Mathematica

#(a,b,c)

Dylan

#(abc)(95)

Smalltalk

{a.b.c}

Squeak

[a;b;c]

F#,OCaml

[abc]

Logo,Oz,Rebol

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

70/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

({a,b,c})

Pike

'(abc)

CommonLisp,EmacsLisp,Scheme

<<a,b,c>>

Eiffel

list(a,b,c)

Io

list

CommonLisp,Dylan,EmacsLisp,Scheme,Tcl

array(a,b,c)

PHP

newt[]{a,b,c}

C#

new[]{a,b,c}

C#3

newList<t>{a,b,c}

C#3

Array(a,b,c)(96)

JavaScript

[NSArray
arrayWithObjects:a,b,
c,nil]

ObjectiveC

setlabc

FishShell

a
b
c

YAML

list/arrayindexing

a[i]

B,BourneShell,C,C#,C++,CoffeeScript,Dylan,E,FishShell,Java,
JavaScript,KornShell,Lua,Maple,merd,Modula3,MSH,Pascal,Perl,Perl6,
PHP,Pike,Python,Ruby

a*[i]ora!iora*(i)
dependingonthe
version

BCPL

a[[i]]

Mathematica

a[i]:default

YCP

a(i)

Ada,Matlab

a:i

Pliant

a/:i

Rebol

a.(i)

F#,OCaml

a.[i]

F#

a!!i

Haskell,Mercury

a@i

Eiffel

aiget(97)

PostScript

aat(i)

Io

at(98)

C++,Smalltalk

lindex

Tcl

nth

CommonLisp,EmacsLisp,OCaml

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

71/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Nth

Oz

aref

CommonLisp,EmacsLisp

nth0/nth1

Prolog

listref/vectorref

Scheme

element

Dylan

slice

Ruby

node[i]

XPath

objectAtIndex

ObjectiveC

item

Logo

aicells+@(for
writeaccess:oai
cells+!

Forth

addinganelementatthebeginning(listcons)
returnthenewlist(nosideeffect)
:

Haskell,merd

::

F#,OCaml,SML

Oz

[e|l]

Erlang,Prolog

[el[]]

Maple

[el]

Matlab

cons

CommonLisp,EmacsLisp,Scheme

pair

Dylan

fput

Logo

Prepend

Ada,Mathematica

sideeffect
unshift

CoffeeScript,JavaScript,Perl,Perl6,Ruby

prepend

YCP

push_front

C++

addFirst

Smalltalk

insert

Rebol

put_first

Eiffel

push

CommonLisp,Io

array_unshift

PHP

PrependTo

Mathematica

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

72/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

addinganelementatindex
returnthenewlist(nosideeffect)
linsertlie

Tcl

Insert

Ada,Mathematica

sideeffect
[ainsertObject:eatIndex:i]

ObjectiveC

a.insert(i,e)

Python,Ruby

ainsertAt(e,i)

Io

aadd:ebeforeIndex:i/aadd:eafterIndex:i

Smalltalk

splice(@a,$i,0,$e)

Perl

addinganelementattheend
returnthenewlist(nosideeffect)
[le]

Matlab

push

merd

arrayByAddingObject

ObjectiveC

lput

Logo

linsertlende

Tcl

Append

Ada,Mathematica

sideeffect
push

CoffeeScript,JavaScript,Perl,Perl6,Ruby

push_back

C++

append

Io,Pliant,Python,Rebol

AppendTo

Mathematica

lappend

Tcl

+=

Pliant

add

Java,Smalltalk,YCP

put_last

Eiffel

array_push

PHP

addObject

ObjectiveC

firstelement
head

Haskell

Head

F#

hd
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

73/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

F#,OCaml
car

CommonLisp,EmacsLisp,Scheme

first

Eiffel,Io,Logo,Pliant,Rebol,Smalltalk

First(99)

Mathematica

First_Element

Ada

iterator
head

Beta

begin

C++

First

Ada

allbutthefirstelement
tail

Haskell

Tail

F#

tl

F#,OCaml

cdr

CommonLisp,EmacsLisp,Scheme

Rest

Mathematica

butfirst

Logo

allButFirst

Smalltalk

l[1:]

Python

a(2:end)

Matlab

L=[_|ButFirst]

Prolog

lrangel1end

Tcl

lastelement
last

E,Eiffel,Haskell,Io,Logo,Pliant,Prolog,Rebol,Scheme,Smalltalk

Last

Mathematica,Oz

lastObject

ObjectiveC

a[1]

Perl,Pike,Python,Ruby

a(end)

Matlab

node[last()]

XPath

(car(lastl))

CommonLisp,EmacsLisp

lindexlend

Tcl

Last_Element

Ada

iterator
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

74/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Last

Ada

allbutthelastelement
Most

Mathematica

getthefirstelementandremoveit
shift

CoffeeScript,JavaScript,Perl,Perl6,Ruby

shift!

merd

pop

CommonLisp,Logo

removeFirst

Io,Smalltalk

array_shift

PHP

getthelastelementandremoveit
pop

CoffeeScript,E,Io,JavaScript,Perl,Perl6,Python,Ruby

pop!

merd

array_pop

PHP

removeLast

Io,Smalltalk

dequeue

Logo

foreachelementdosomething
each

merd,Pliant,Ruby

forvinl...

CoffeeScript,E,Maple,Ruby

forvinl:...

Python

forvinl;do...;done

BourneShell

forvinldo...

F#

forvinl;...;end

FishShell

for(vinl)...

Awk,Dylan

for(varvinl){...}

JavaScript

ForEachvinl...Next

VisualBasic

forvinrangeloop..endloop

Ada

for

Perl

foreach

Logo,Lua,Perl,PHP,Pike,Rebol,Tcl

foreach(tvinl)...

C#

foreach(vinl)...

C#3

foreach($vinl)...

MSH

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

75/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

foreach(tv,l,{...})

YCP

lforeach(v,...)

Io

for_each

C++

foreach

Scheme

forall

PostScript,Prolog

ForAll

Oz

iter

F#,OCaml

do

Smalltalk

do_all

Eiffel

app

SML

mapc

EmacsLisp

mapM_

Haskell

Scan

Mathematica

(dolist(vl)...)(loopforvinldo...)mapc

CommonLisp

list.iterate(#docurrent...#)

Beta

l.Iterate(...)

F#

Iterate

Ada

transformalist(orbag)inanotherone
map

Dylan,F#,Haskell,Io,Maple,Mercury,merd,OCaml,Perl,Pike,
Python,Ruby,Scheme,SML

Map

F#,Mathematica,Oz

mapcar

CommonLisp,EmacsLisp

maplist

Prolog,YCP

sublist

Prolog

map/map.se

Logo

foreach

XSLT

foreachorselected

MSH

collect

Ruby,Smalltalk

transform

C++

array_map

PHP

/@

Mathematica

[fx|x<l](100)

Haskell

[f(x)forxinl](100)

Python

magical:sin(x)computessinon
eachelement

Matlab

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

76/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

transformtwolistsinparallel
map2

F#,OCaml

zipWith

Haskell

Zip

Maple,Oz

map

Dylan,Logo,Python,
Scheme

map.se

Logo

mapcar

CommonLisp

maplist2

Prolog

l1with:l2collect:...

Smalltalk

transform

C++

ListPair.map

SML

magical:abinaryfunctionoroperatorisappliiedoneach
element

Matlab

findanelement
find

C++,CommonLisp,F#,Haskell,merd,OCaml,Rebol,Ruby,
SchemeSRFI1,SML,YCP

Find

Ada

find_if

C++

findif

CommonLisp

first(21)

Perl

detect

Ruby,Smalltalk

search

Pike

ListTools[Search]

Maple

lsearchexact

Tcl

index

Python

indexOf

Io

indexOfObject,
indexOfObjectIdenticalTo

ObjectiveC

find(a==3)

Matlab

Position

Mathematica

keepelements
matching
find_all

F#,OCaml,Ruby
F#,Haskell,Mercury,merd,OCaml,Pike,Python,SchemeSRFI1,

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

77/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

filter

SML,YCP

filter!

SchemeSRFI1

Filter

Oz

grep

Perl,Perl6

where

MSH

select

Io,Maple,Ruby,Smalltalk

Select/Case

Mathematica

selectInPlace

Io

removeifnotdeleteif
not

CommonLisp

choose

Dylan

array_filter

PHP5

[x|x<l,px](100)

Haskell

[xforxinlifp(x)]
(100)

Python

a(a==3)

Matlab

nonmatching
removeifdeleteif

CommonLisp

reject

Ruby

partitionalist:elementsmatching,elementsnonmatching
partition

F#,Haskell,merd,OCaml,Ruby,SchemeSRFI1,SML

partition!

SchemeSRFI1

Partition

Oz

splitalist
in2basedonapredicate
break

Haskell

span

Haskell

intosublistsdelimitedbyelementsmatchingapredicate
splitsequence(101)

CommonLisp

ListTools[Split]

Maple

intoalistoflistsofsamevalue
group

Haskell

Split

Mathematica

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

78/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

intosublistsbasedonapredicate
groupBy

Haskell

Split

Mathematica

isanelementinthelist
member?

Dylan,merd,Ruby

include?

Ruby

mem

F#,OCaml

member

CommonLisp,Prolog,Scheme

Member

Oz

MemberQ

Mathematica

memqmemv

Scheme

memberp/member?

Logo

contains

E,Io,YCP

containsObject

ObjectiveC

in

CoffeeScript,JavaScript,Python,SQL92,Tcl8.5

in_array

PHP

includes

Smalltalk

elem

Haskell,Mercury

has

Eiffel

has_value

Pike

ismember

Matlab

/elt/

GNUsed

isthepredicatetrueforanelement
any(30)

Haskell,Matlab,Mercury,Python,SchemeSRFI1

any?

Dylan,Ruby

anySatisfy

Smalltalk

exists

F#,OCaml,SML

exists?

merd

some

CommonLisp

Some

Oz

ormap

Maple

detect

Io

isthepredicatetrueforeveryelement
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

79/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

all(30)

Haskell,Mercury,Python,SML

All

Oz

all?

merd,Ruby

allSatisfy

Smalltalk

every

CommonLisp,SchemeSRFI1

every?

Dylan

for_all

F#,OCaml

andmap

Maple

smallest/biggestelement
min/max

CommonLisp,Eiffel,Io,Java,Maple,Matlab,Perl6,PHP5,Pike,Prolog,
Python,Ruby,Scheme,Smalltalk

Min/Max

Mathematica

minimum/maximum

Haskell,Mercury,merd

minimumof/
maximumof

Rebol

minminstr/max
maxstr(21)

Perl

min_element/
max_element

C++

joinalistofstringsinastringusingagluestring
join(s,l)

Perl,Perl6,PHP

String.Join(s,l)

C#

s.join(l)

Python

l.join(s)

CoffeeScript,JavaScript,Perl6,Ruby

lasStringWith:s

Smalltalk

joinls

Tcl

implode(s,l)

PHP

ListTools[Join]

Maple

rjoin

join

Io

concat

F#,OCaml

strcat

Matlab

concat_atom

Prolog

l*s

Pike,Ruby

(mapconcat'identityls)

EmacsLisp

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

80/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

componentsJoinedByString

ObjectiveC

intercalate

Haskell

StringJoin@@Riffle[l,s]

Mathematica

listsize
size

C++,Dylan,E,Io,Java,Matlab,merd,Pliant,Ruby,Scilab,Smalltalk,YCP

sizeof

Pike

length

C#,CoffeeScript,CommonLisp,EmacsLisp,F#,Haskell,Java,JavaScript,Matlab,Mercury,
OCaml,PostScript,Prolog,Ruby,Scheme,SML

Length

Ada,F#,Mathematica,Oz

length?

Rebol

len

Python

llength

Tcl

$LENGTH

MUMPS

elems

Perl6

getn

Lua

count

Eiffel,FishShell,ObjectiveC,PHP,SQL92,XPath

numel

Matlab

scalar
@l

Perl

nops

Maple

Lua

iteratewithindex
each_with_index

merd,Ruby

enumerate(l)

Python

foreach($las$i=>$v)

PHP

aforeach(i,e,...)

Io

fori=>vinl

for(vinl,ifrom0)...end

Dylan

forAllInd

Oz

foreachi

Lua

foreach(l;typ0i;typ1v){...}

Pike

withIndexDo

Squeak

iteri

F#,OCaml

IterateIndexed

F#

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

81/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

MapIndexed

Mathematica

(loopforvinlasiupfrom0do...)

CommonLisp

forv,iinl...

CoffeeScript

removeduplicates
uniq

merd,Perl6,Pike,Ruby

uniq!

Ruby

uniq2

Pike

unique(102)

C++,Io,Matlab,Rebol

nub

Haskell

array_unique

PHP

ListTools[MakeUnique]

Maple

deleteduplicates

CommonLisp,SchemeSRFI1

deleteduplicates!

SchemeSRFI1

removeduplicates

CommonLisp,Dylan

lsortunique

Tcl

toset

YCP

distinct

SQL92

set

Python

Union

Mathematica

sort

sort(103)

C#,C++,CoffeeScript,CommonLisp,E,Eiffel,F#,Haskell,Io,Java,
JavaScript,Lua,Maple,Matlab,merd,OCaml,Perl,Perl6,PHP,Pike,
Prolog,Python,Rebol,Ruby,Scheme,XSLT,YCP

sort!

Ruby

sorted

Python

Sort

Mathematica,Oz

sort_by

merd,Ruby

sortBy

Haskell,Io,Smalltalk

orderby

SQL92

lsort

Tcl

asort

Awk

sortobject

MSH

sortedArrayUsingSelector,
sortUsingSelector

ObjectiveC

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

82/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

predsort/keysort/
mergesort

Prolog

reverse

reverse

C++,CoffeeScript,CommonLisp,Dylan,EmacsLisp,Haskell,Io,Java,
JavaScript,Logo,Mercury,merd,Perl,Perl6,Pike,Prolog,Python,Rebol,Ruby,
Scheme

Reverse

C#,Mathematica,Oz

reversed

Python,Smalltalk

reverse_copy

C++

rev

F#,OCaml,SML

Reverse_Elements

Ada

lreverse

Tcl8.5

array_reverse

PHP

ListTools[Reverse]

Maple

fliplrflipud...

Matlab

l[::1]

Python

listofcouplesfrom2lists
combine

F#,OCaml

zip

F#,Haskell,Maple,merd,Perl6,Python,Ruby,SchemeSRFI1,SML

pairlis(104)

CommonLisp

transpose

Ruby

Transpose

Mathematica

[ab]

Matlab

2listsfromalistofcouples
split

F#,OCaml

unzip

F#,Haskell,merd,SML

unzip2

SchemeSRFI1

transpose

Ruby

Transpose

Mathematica

zip(*l)

Python

a(1,:),a(2,:)

Matlab

lookupanelementinaassociationlist

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

83/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

lookup

Haskell

assoc

CommonLisp,EmacsLisp,F#,OCaml,Ruby,Scheme

assq

EmacsLisp,Scheme

assv

Scheme

get_assoc

Prolog

select

Rebol

a.(e)

Matlab

a[e]

Maple

gprop

Logo

/.

Mathematica

listoutofabag
to_a

Ruby

toArray

Java

asArray

Smalltalk

to_list

merd

list

Python

mapas(<list>,bag)

Dylan

[a.(:)]

Matlab

arrayget

Tcl

f(...f(f(init,e1),e2)...,en)
foldl

Haskell,Maple,Mercury,merd,SML

FoldL

Oz

fold_left

OCaml

fold

F#,SchemeSRFI1

Fold

Mathematica

reduce(105)

CommonLisp,Dylan,Io,Perl,Perl6,Pike,Python

inject

Ruby

injectinto

Smalltalk

f(e1,f(e2,...f(en,init)...))
foldr

Haskell,Maple,Mercury,merd,
SML

FoldR

Oz

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

84/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

foldright

SchemeSRFI1

fold_right

OCaml

foldBack

F#

rreduce

Pike

(reducef'(e1e2...en):fromrightt:initialvalue
init)

CommonLisp

reverseReduce

Io

VariousDataTypes
tupletype
typ1*...*typn

F#,OCaml,SML

(typ1,...,typn)

Haskell

typ1,...,typn

merd

tuple

Python

tuple!

Rebol

Tuple[Typ1,Typ2,Typ3]

tuple<typ1,...,typn>

C++0x

tupleconstructor
a,b,c

F#,Lua,merd,OCaml,Python,Ruby

(a,b,c)

Ada,C++0x,Haskell,Perl,Prolog,SML

{a.b.c}

Smalltalk

{a,b,c}

Matlab

[a,b,c]

a.b.c

Rebol

(consab)

CommonLisp

computabletuple(theseareakindofimmutablelistsplayingaspecialroleinparameterpassing)
emptytuple
()

merd,Perl,Perl6,Python

[]

Ruby

{}

Matlab,Smalltalk

#()

Smalltalk

Nothing

Prolog

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

85/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

1uple
aor[a]

Ruby

a,

Perl6,Python

tuple([a])

Python

(a)

Perl

((a))

merd

{a}

Smalltalk

usingatupleforafunctioncall
t

merd,Perl

*t

Python,Ruby

t{:}

Matlab

f@@t

Mathematica

L=..[F|Args],call(L)

Prolog

reference(pointer)
creation
&

B,C,C#,C++

Perl

AddressOf

VisualBasic

addr(106)

Pascal

@(106)

Pascal

lv

BCPL

ref

C#,F#,OCaml,SML

newSTRef

Haskell

NewCell

Oz

variable

Forth

'access

Ada

:>:>>

Pliant

''

Maple

dereference
*(107)

B,C,C#,C++

$@%&(107)

Perl

>[...]>{...}>(...)(108)

Perl

>(109)

C,C++

^(108)

Modula3,Pascal

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

86/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

!(107)

F#,OCaml,SML

rv

BCPL

readSTRef

Haskell

Access

Oz

.[all]

Ada

Forth

eval

Maple

(reg)

Assembler

assigning(whendereferencingdoesn'tgivealvalue)
writeSTRef

Haskell

Assign

Oz

:=

F#,OCaml,SML

Forth

optionalvalue
nullvalue
0(110)

C++,Forth

0nullptr(110)

C++0x

NULL

C,Maple,SQL92

nil

CommonLisp,EmacsLisp,Io,Lua,ObjectiveC,Ruby,Smalltalk

null

C#,CoffeeScript,Java,JavaScript

Null(111)

Ada,Mathematica

undef

Perl

None

F#,OCaml,Python

NONE

SML

Nothing

Haskell

Void

Eiffel

#f()

EmacsLisp

(empty)/~/null

YAML

value
v

Ada,C#,CoffeeScript,CommonLisp,Eiffel,EmacsLisp,Java,JavaScript,Lua,Perl,Perl,
Python,Ruby,Scheme,Smalltalk

*v(110)

C,C++

Justv

Haskell

Somev

F#,OCaml

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

87/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

SML

SOMEv

typename
option

F#,OCaml,SML

Maybe

Haskell

nullcoalescing
COALESCE

SQL92

?:

PHP

||

JavaScript,Perl,Ruby

//(112)

Perl

??

C#

if(a,b)

VisualBasic

or

Python,Scheme

record
typedeclaration
struct{typ1n1;typ2n2;...}

C,C++

typetyp={n1:typ1;n2:typ2}

OCaml,SML

dataTyp=N0{n1,n2::typ1,n3::typ3,...}

Haskell

typeTypisrecord
N1:Typ1;
N2:Typ2:=default_val;
...
endrecord;

Ada

selector
.

Ada,Beta,C,C#,C++,CoffeeScript,E,Eiffel,F#,Java,JavaScript,Lua,Matlab,
Modula2,Modula3,OCaml,Oz,Pascal,Python,Ruby

::

XPath

Fortran90

'(113)

Ada

Mercury

r{field}

merd

r:field

Pliant

fieldr

Haskell

>

C,C++

r[field]

Maple

r["field"]

JavaScript

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

88/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

#fieldr

SML

normal
function
call

CommonLisp,Dylan,Haskell,Io,Smalltalk

uniontypedeclaration
union{typ1n1;typ2n2;...}

C,C++

dataTyp=N1typ1|N2typ2|...

Haskell

typetyp=N1oftyp1|N2oftyp2|...

OCaml

datatypetyp=N1oftyp1|N2oftyp2|...

SML

typeTyp(Choice:Discrete_Type)isrecord
caseChoiceis
whenChoice_1=>
N1:Typ1;
...
whenChoice_2|Choice_3=>
...
whenothers=>
...
endcase;
endrecord;

Ada

enumeratedtypedeclaration
enumtyp{n1;n2;...}(114)

C,C#,C++,Java

Enumtyp
n1
n2
EndEnum

VisualBasic

(n1,n2,...)

Pascal

typetypis(115)

Ada

dataTyp=N1|N2|...

Haskell

typetyp=N1|N2|...

OCaml

datatypetyp=N1|N2|...

SML

dictionary
typename
map

YAML

Map

F#,Io

std::map

C++

dict

Python

Dictionary

Pliant,Smalltalk

Hash

Perl6,Ruby

HASH

Perl

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

89/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

HASH_TABLE

Eiffel

HashTable

Java

Hashtbl

F#

Hashtbl.t

OCaml

struct

Matlab

table

Maple

array

PHP

Data.Map,Data.HashTable

Haskell

Containers.Ordered_Maps.Map

Ada

constructor
[a=>b,c=>d]

array(a=>b,c=>d)

PHP

{a=>b,c=>d}

Perl,Perl6,Ruby

{a,b,c,d}

Perl,Ruby

{a:b,c:d}

CoffeeScript,JavaScript,Python,
YAML

{a:b;c:d}

CSS

$[a:b,c:d]

YCP

{a>b.c>d}

Squeak

{a=b,c=d}

Lua

@{a=b;c=d}

MSH

([a:b,c:d])

Pike

([a]=b[c]=d)

KornShell

<<abcd>>

PostScript

struct(a,b,c,d)

Matlab

Hash[a,b,c,d]

Ruby

Map.of_list[a,b;c,d]

F#

Hashtbl.of_list[a,b;c,d]

F#

table([a=b,c=d])

Maple

definetablefooa=>b;c=>dend

Dylan

dictcreateabcd

Tcl8.5

newt{{a,b},{c,d}}

C#

fromList

Haskell

[NSDictionarydictionaryWithObjectsAndKeys:b,a,d,c,
nil]

ObjectiveC

a:b

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

90/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

a:b
c:d

YAML

access:read/write
h[k]

Awk,C#,C++,CoffeeScript,Dylan,E,JavaScript,Lua,Maple,MSH,PHP,Python,
Ruby

$h{k}

Perl

%h{k}or
%h<s>

Perl6

h(k)

Tcl

h.[k]

F#

h.k

CoffeeScript,JavaScript,Lua,Matlab

h:k

Pliant

h["k"]orh
>k

Pike

(gethashkh)

CommonLisp

access:read
hkget

PostScript

find

F#,OCaml

fetch

Ruby

get

Java

dictget

Tcl8.5

at

Io,Smalltalk

h@korh.at(k)

Eiffel

h[k]:default

YCP

${h[k]}

KornShell

h.get(k,returned_value_when_k_unfound)

Python

objectForKey

ObjectiveC

lookup

Haskell

Element

Ada

access:write
hkoput

PostScript

put

Eiffel,Java

add,replace

F#,OCaml

store

Ruby

dictset

Tcl8.5

h[k]

KornShell,YCP

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

91/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

atPut

Io

hat:kput:o

Smalltalk

[hsetObject:oforKey:k]

ObjectiveC

insert

Haskell

Replace_Element

Ada

hasthekey?
exists$h{k}

Perl

exists

Perl6,Pliant

dictexists

Tcl8.5

has

Eiffel

haskey

YCP

hasKey

Io

has_key

Python

has_key?,include?,key?,member?

Ruby

Contains

Ada,C#,F#

containsKey

Java

includesKey

Smalltalk

kinh

CoffeeScript,JavaScript,Python

knotinh

Python

in

Awk

mem

F#,OCaml

member

Haskell

isfield

Matlab

find(116)

C++

h[k]

Pike

(gethashkh)

CommonLisp

maps

known

PostScript

isset(h[k]),array_key_exists(k,h)

PHP

removebykey
delete$h{k}

Perl

delh[k]

Python

unset(h[k])

PHP

remove

Eiffel,F#,Java,OCaml,YCP

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

92/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Remove

C#,F#

dictremove

Tcl8.5

removeAt

Io

removeKey

E,Smalltalk

remhash

CommonLisp

delete

CoffeeScript,Haskell,JavaScript,Perl6,Ruby

Delete

Ada

erase

C++

m_delete

Pike

removeObjectForKey

ObjectiveC

undef

PostScript

rmfield

Matlab

listofkeys
keys

Haskell,Io,Maple,MSH,Perl,Perl6,Python,Ruby,Smalltalk

dictkeys

Tcl8.5

keySet

Java

allKeys

ObjectiveC

AllKeys

C#

indices

Pike

current_keys

Eiffel

getKeys

array_keys

PHP

fieldnames

Matlab

findall(Key,item(Key,_),Keys)

Prolog

${!h[@]}

KornShell

listofvalues
values

Io,Java,Perl,Perl6,Pike,Python,Ruby,Smalltalk

dictvalues

Tcl8.5

getValues

content

Eiffel

array_values

PHP

struct2cell

Matlab

entries

Maple

elems

Haskell

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

93/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

KornShell

${h[@]}

merge
merge(117)

Ruby

array_merge(117)

PHP

union(118)

Haskell

update(117)

Python,Ruby

putAll(117)

Java

insert(118)

C++

(%h1,%h2)(117)

Perl

range
inclusive..inclusive
a..b

Ada,E,merd,MSH,Pascal,Perl,Ruby

a:b

Matlab

[a..b]

CoffeeScript,F#,Haskell

to

Io,Smalltalk

seqab/jotab(119)

BourneShell,FishShell

{a..b}

KornShell

range

PHP

range(from:a,to:b,by:step)

Dylan

Range

Mathematica

Rangewith

Io

List.numberABStep

Oz

numlist/between

Prolog

iseq

Logo

inclusive..exclusive
a...b

CoffeeScript,Ruby

a..!b

range

Python

Mathematics
typename
integers
short,int,long
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

94/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

C,C#
int

OCaml,PHP,SML,
YAML

Int

Perl6

Int,uInt,Int8,Int16...

Pliant

int,long(120)

Python

integer

Maple,PHP

INTEGER,INT,SMALLINT

SQL92

INTEGER,INTEGER_8,NATURAL_8...

Eiffel

int8,uint8,int16,uint16,...64

Matlab

int8_t,uint8_t,int16_t,uint16_t,...64

C99

int,int8,uint8,int16,uint16,int32,uint32,int64,uint64,
bigint,bignum

F#

Int,Integer,Int8,Int16,Int32,Int64

Haskell

Integer,FixNum,BigNum

Ruby

Integer,SmallInteger,LargeInteger

Smalltalk

Integer

Mathematica

typeTisrangeLow...High;

Ada

floatingpoint
float,double,longdouble

float,double

C#

float

Maple,OCaml,PHP,SML,YAML

Float

Ruby

float,float32

F#

Float,Float32,Float64

Pliant

NUMERIC,DECIMAL,DOUBLEPRECISION

SQL92

Rat

Perl6

DOUBLE,REAL

Eiffel

single,double

Matlab

Float,Double,Ratio

Haskell

Float,Double,Fraction,FixedPoint

Smalltalk

float,decimal.Decimal

Python

Real,Rational

Mathematica

Number

Io

typeTisdigitsNrangeLow..High;

Ada

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

95/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

typeTisdeltaSdigitsNrangeLow..High;(121)

Ada

numberssyntax
integers
1000

Awk,B,BourneShell,C,C#,C++,CoffeeScript,E,Eiffel,F#,Forth,Haskell,Io,Java,
JavaScript,Logo,Maple,Mathematica,merd,OCaml,Oz,Pascal,Perl,Perl6,PHP,Pike,
Pliant,Prolog,Python,Rebol,Ruby,Scheme,Smalltalk,SQL92,Tcl,Yorick

1000,
1000.

CommonLisp,EmacsLisp

1000,
1000.,
1000.0

Awk,Matlab

1000,
'1000'D

ClassicREXX

1000,
1E3

Ada

integersinbase2,octalandhexadecimal
0b1,07,0xf(122)

CoffeeScript,Oz,Perl,PHP5,Pike,Ruby

0b1,0o7,0xf

F#,OCaml,Perl6

07,0xf

Awk,C,C++,JavaScript,Python,Tcl

0xf

C#,E,Io,Yorick

07

0o7,0xf

Haskell

1b

Eiffel

2#1#,8#7#,16#f#

Ada

2#{1},#{F}

Rebol

#b1,#o7,#xf

CommonLisp,EmacsLisp,Scheme

2^^1,8^^7,16^^f

Mathematica

2r1,8r7,16rf

Smalltalk

#2r1,#8r7,#16rf

CommonLisp,EmacsLisp

1b,Fh

Pliant

'1'B,'F'X

ClassicREXX

B'1',X'F'

SQL92

$f

Forth

integerthousandseparator
1_000,10_00,100_0

Ada,E,Eiffel,OCaml,Perl,Perl6,Ruby

1'000,10'00,100'0

Rebol

1_000

merd

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

96/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

floatingpoint
1000.,1E3

C,C++,ClassicREXX,CoffeeScript,E,F#,Java,JavaScript,Logo,Maple,OCaml,
Python,Scheme,SQL92,Tcl

1000.,1E3,1,0

Rebol

1000.,1.E3

Eiffel,Oz

1000.0,1E3

C#,CommonLisp,EmacsLisp,PHP,Pike,Prolog,Ruby,Smalltalk

1000.0,1.0E3

Ada,Haskell

1000,1000.0,
1E3(123)

Awk,merd,Perl,Perl6

1000.,1*^3,
1000`

Mathematica

1000e,1e3

Forth

addition/subtraction/multiplication/division
+//*/
/

BourneShell,C,C#,C++,ClassicREXX,CoffeeScript,CommonLisp,Eiffel,Emacs
Lisp,F#,Forth,Haskell,Io,Java,JavaScript,Logo,Maple,Matlab,merd,MUMPS,
Perl,Perl6,PHP,Pliant,Prolog,Python,Ruby,Scheme,Smalltalk,SQL92,Tcl,Yorick

+//*or
nothing//

Mathematica

++./.
/**.//
/.(124)

OCaml

sum/
difference/
product/
quotient

Logo

add/sub/
mul/idiv
div

PostScript

f+/f/f*
/f/

Forth

exponentiation(power)
**

Ada,ClassicREXX,E,F#,Fortran,Io,merd,OCaml,Perl,Perl6,PL/I,Prolog,
Python,Rebol,Ruby,Tcl8.5

Awk,Dylan,Eiffel,Lua,Mathematica,Matlab,Pliant,Yorick

*(125)

APL

**,^

Maple

**,^and
^^(126)

Haskell

f**

Forth

pow

C,C++,CoffeeScript,Java,JavaScript,PHP,Pike,Python,SML,Tcl

Pow

C#,Oz

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

97/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

power

DelphiKylix,Logo,Rebol

exp

PostScript

expt

CommonLisp,EmacsLisp,Scheme

raisedTo

Smalltalk

negation

Ada,Awk,B,BCPL,BourneShell,C,C#,C++,ClassicREXX,CoffeeScript,CommonLisp,
E,Eiffel,EmacsLisp,F#,Haskell,Io,Java,JavaScript,Logo,Maple,Mathematica,Matlab,
merd,MUMPS,Perl,Perl6,PHP,Pike,Pliant,Prolog,Python,Rebol,Ruby,Scheme,
Smalltalk,Tcl,Yorick

OCaml

Oz,SML

neg

PostScript

negate

Forth,Rebol

fnegate

Forth

minus

Logo

random
randomnumber
rand

C,Maple,Matlab,Perl,Perl6,PHP,Ruby,Tcl

random

CommonLisp,Logo,Prolog,Python,Yorick

$RANDOM

MUMPS

randomR

Haskell

Random(127)

Ada

Random.int

OCaml

Random,RandomReal,RandomInteger

Mathematica

Randomvalue

Io

RandomnewnextInteger

Smalltalk

r:RANDOM
creater.make
r.start
r.item

Eiffel

Randomran=newRandom();
ran.Next(...);

C#

letr=System.Random()
r.Next()

F#

mt_rand

PHP

seedthepseudorandomgenerator
srand
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

C,Perl,Perl6,PHP,Ruby,Tcl
98/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

set_seed

Eiffel

random.seed

Python

RandomsetSeed

Io

Random.init,Random.self_init

OCaml

rand('state',...)

Matlab

rerandom

Logo

RandomTools[MersenneTwister][SetState]

Maple

RandomnewsetSeed

Smalltalk

SeedRandom

Mathematica

mkStdGen

Haskell

makerandomstate

CommonLisp

Reset

Ada

operatorprioritiesandassociativities
additionvsmultiplication
mathematical

BourneShell,C,C#,C++,ClassicREXX,Eiffel,F#,Haskell,Io,Java,Maple,
Mathematica,Matlab,merd,Perl,Perl6,PHP,Python,Ruby,Tcl,Yorick

same
priorities

MUMPS,Smalltalk

exponentiationvsnegation(is3^2equalto9or9)
mathematical

ClassicREXX,Eiffel,Haskell,Io,Maple,Mathematica,Matlab,Perl,Perl6,Python,
Ruby

negation
first

F#,OCaml

squareroot/eexponential/absolutevalue
sqrt/exp/
abs

Ada,C,C++,CoffeeScript,CommonLisp,E,Eiffel,EmacsLisp,F#,Haskell,Io,
Java,JavaScript,Lua,Maple,OCaml,Pascal,Perl,Perl6,PHP,Prolog,Python,Ruby,
Scheme,Smalltalk,SML,Tcl,Yorick

sqrtrealsqrt
/exp/abs

Matlab

sqrt/exp/

Awk,Logo

Sqrt/Exp/
Abs

C#,Mathematica,Oz

sqrt//abs

PostScript

Sqrt//ABS

Modula3

/exp/abs

Pliant

sqrt//

Pike

squareroot/
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

99/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

exp/absor
absolute

Rebol

Sqrt/Exp/
ABS

ClassicREXX

sqrt,isqrt/
exp/abs

Tcl8.5

fsqrt/fexp/
abs,fabs

Forth

trigonometry
basic
sin/cos
/tan

Ada,C,C++,CoffeeScript,CommonLisp,E,EmacsLisp,F#,Haskell,Io,Java,JavaScript,
Lua,Maple,Matlab,OCaml,Pascal,Perl,Perl6,PHP,Pike,Pliant,Prolog,Python,Ruby,
Scheme,Smalltalk,SML,Tcl,Yorick

Sin/Cos
/Tan

C#,ClassicREXX,Mathematica,Oz

sin/cos
/

Awk,PostScript

sine/
cosine/
tangent

Eiffel,Rebol

radsin/
radcos/
radtan

Logo

fsin/
fcos/
ftan

Forth

inverse
asin/acos/
atan(128)

Ada,C,C++,CoffeeScript,CommonLisp,F#,Haskell,Io,JavaScript,Matlab,
OCaml,Perl,Perl6,Pike,Pliant,Prolog,Python,Ruby,Scheme,Tcl,Yorick

Asin/Acos/Atan

C#,Oz

ASin/ACos/ATan

ClassicREXX

arcsin/arccos/
arctan

Maple

arcSin/arcCos/
arcTan

Smalltalk

ArcSin/ArcCos/
ArcTan

Mathematica

arcsine/
arccosine/
arctangent

Rebol

arc_sine/
arc_cosine/
arc_tangent

Eiffel

//atan

PostScript

//radarctan

Logo

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

100/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

fasin/facos/
fatan

Forth

logarithm
basee
ln

DelphiKylix,Logo,Maple,Pascal,PostScript,Smalltalk,SML

log

Awk,C,C++,CoffeeScript,CommonLisp,E,Eiffel,EmacsLisp,F#,Io,Java,JavaScript,Lua,
Maple,Matlab,OCaml,Perl,Perl6,PHP,Pike,Pliant,Prolog,Python,Ruby,Scheme,Tcl,Yorick

Log

Ada,C#,ClassicREXX,Mathematica,Oz

log
10

Haskell

log
e

Rebol

fln

Forth

base10
log10

C,C++,DelphiKylix,Eiffel,F#,Io,Logo,Lua,Matlab,OCaml,Perl,Perl6,PHP,
Pliant,Prolog,Python,Ruby,Tcl,Yorick

Log10

C#,ClassicREXX

log

PostScript,SML

log:10

Smalltalk

log10

Rebol

log[10]

Maple

Log[10,val]

Mathematica

logBase10

Haskell

Log(X=>val,
Base=>10.0)

Ada

(logx10)

CommonLisp

flog

Forth

base2
log2

Matlab

log10/log2

Rebol

Log(X=>val,Base=>2.0)

Ada

log(val,2)

Python

Log[2,val]

Mathematica

frexp

euclidiandivision(bothquotientandmodulo)
divmod

Python,Ruby

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

101/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

divMod

Haskell

divldivlldiv

IntInf.quotrem

SML

floor

CommonLisp,Dylan

/mod

Forth

modulo
moduloof3/2is1
%

ClassicREXX,Perl,Perl6,Pike,Python,Ruby,Tcl

%%

\\

Smalltalk

mod

Ada,CommonLisp,EmacsLisp,Haskell,Matlab,Prolog,SML

Mod

Mathematica

MOD

Modula3

modulo

Dylan,Logo,Ruby

rem

Prolog

moduloof3/2is1
%

Awk,B,C,C#,C++,CoffeeScript,E,F#,Io,Java,JavaScript,PHP,Pliant,Yorick

MUMPS

mod

F#,Forth,Lua,OCaml,Oz,Pascal,PostScript,Prolog,XPath

remainder

Logo,Ruby,Scheme

rem

Ada,BCPL,Haskell,Matlab,Smalltalk

//

ClassicREXX,Rebol

\\

Eiffel

truncate/round/floor/ceil
trunc/round/floor/ceil

C,C++,Maple,Matlab

truncate/round/floor/ceiling

CommonLisp,Haskell,Perl6,PostScript,
Prolog,Scheme

int/round/floor/ceil

CoffeeScript,JavaScript,Pike,Python

int/round//

Logo

to_i,Integer()/round/floor/ceil

Ruby

TRUNC/FORMAT/Floor/Ceil

ClassicREXX

Float'Truncation/Float'Rounding/Float'Floor/
Float'Ceiling(129)

Ada

/round/floor/ceil

E,Io,Java,Lua,PHP,SML,Tcl

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

102/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

/Round/Floor/Ceiling

C#

/Round/Floor/Ceil

Oz

/round/floor/ceiling

Dylan,EmacsLisp,PostScript,XPath

/ROUND/FLOOR/CEILING

Modula3

/rounded/floor/ceiling

Eiffel,Smalltalk

int//floor/ceil

F#,Perl

int_of_float//floor/ceil

F#,OCaml

//floor/ceil

Lua,Yorick

IntegerPart/Round/Floor/Ceiling

Mathematica

/Rounding/Floor/Ceiling

Ada

tointeger///

Rebol

/fround//

Forth

bitwiseoperators
and/or/xor
&/|/^

C,C#,C++,CoffeeScript,E,Eiffel,Java,JavaScript,Perl,PHP,Pike,
Python,Ruby,Tcl

&/|/~

Yorick

&/|

YCP

+&/+|/+^

Perl6

.&./.|./xor(130)

Haskell

&&&/|||/^^^

F#

and/or/xor

Ada,Forth,PostScript,Rebol

land/lor/lxor

F#,OCaml

logand/logior/
logxor(131)

CommonLisp

bitand/bitor/bitxor

Logo,Matlab

BITAND/BITOR/BITXOR

ClassicREXX

BitAnd/BitOr/BitXor

Mathematica

bitAnd/bitOr/bitXor

Smalltalk

bitwiseAnd/bitwiseOr/
bitwiseXor

Io

/\/\//xor

Prolog

bitwiseinversion
~

C,C#,C++,CoffeeScript,Java,JavaScript,Perl,PHP,Pike,Python,Ruby,SML,
Tcl,YCP

~~~
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

103/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

F#
not

Ada,Eiffel,PostScript

lnot

F#,OCaml

lognot(132)

CommonLisp

bitnot

Eiffel,Logo

BitNot

Mathematica

complement

Haskell,Rebol

bitcmp

Matlab

bitInvert

Smalltalk

bitwiseComplement

Io

invert

Forth

Prolog

leftshift/rightshift/unsignedrightshift
<</>>/>>>

CoffeeScript,Java,JavaScript

<</>>

C,C#,C++,Perl,PHP,Pike,Prolog,
Python,Ruby,Tcl,YCP

<<</>>>

F#

|<</|>>

Eiffel

lsl/lsrorasr

F#,OCaml

bitshift

Matlab,PostScript

bitShift

Smalltalk

ashiftlshift

Logo

lshift/rshift

Forth

shiftL//shiftR

Haskell

shiftLeft/shiftRight

Io

Shift_Left/Shift_Right/Shift_Right_Arithmetic/
Rotate_Left/Rotate_Right

Ada

(ashxpositiveinteger)/(ashxnegativeinteger)/

CommonLisp

Threads
threaddefinition
classclass_name(threading.Thread){[overriderunmethod]}

Python

tasktask_nameis[entryentry_name[(parameter...)]...]endtask_name

Ada

tasktypetask_type_nameis[entryentry_name[(parameter...)]...]end
task_type_name

Ada

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

104/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

classclass_nameextendsThread{[overriderunmethod]}

Java

thread...

Pliant

parallel[threadsnb_threads][minimini_threshold][maximaxi_threshold][active]
...
task
parallel_instructions
Pliant
[post
sequential_instructions]
...
[NSThreaddetachNewThreadSelector:mainFunctiontoTarget:targetwithObject:obj]

Objective
C

threadcreation
objectt=Thread.Thread(f)

Pike

sett[threadcreate{code}]

Tcl

ThreadcreateThread(...)

Io

threadobjectcreation
MyTask:task_type_name;

Ada

class_nameMyThread=newclass_name()

Java

p:=[...]newProcess.

Smalltalk

p:=[...]fork.(133)

Smalltalk

starting/stoppingthreads
start()/stop()(134)

Java

resume/suspend/terminate

Smalltalk

Tasksarestartedwhencreated/callStopentryor"aborttaskobjectname"

Ada

threadsend$t{script}

Tcl

passingdatadirectlybetweenthreads
callanentrywithparameters

Ada

callanypublicmethod

Java

commonvariablesarecopiedatthreadcreation,inabscenceofa"share"statement

Pliant

usemessages,parametersorsharedvariables(135)

Smalltalk

terminatingthreadcommunicationduetoatimeout
selecttask_entry_call;ordelaytimeout_limit;endselect;

Ada

ThreadSynchronization
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

105/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

DefiningaSynchronizedSharedResource
Tcl

thread::mutex

protectedObject_Nameis[entryentry_name(Parameter:[inout]istype[...]);
procedureprocedure_name(Parameter:[inout]istype[...]);
functionfunction_namereturntype;
Ada
private
shareddatadeclaration
endObject_Name;
synchronize(this){...}

Java

SharedQueue,Semaphorecritical:[...],Future,LazyValue

Smalltalk

SynchronizedWritingtoasharedresource
Object_Name.Entry_Name(Parms)
Object_Name.Procedure_Name(Parms)

Ada

Object_Name.SetMethod(Parms)

Java

SynchronizedReadingofaSharedResource
Object_Name.Function_Name

Ada

Object_Name.GetMethod()

Java

MonitorSyntax
Ada

Objectg_Name.Entry_Name(Parms)

JoiningAnotherThread
Suspendingathreaduntilanotherthreadcompletes
Calltaskentryservicedjustbeforetasktermination

Ada

OtherThread.join()

Java,Python

SuspendingaThreadUntilAnotherThreadEstablishesAnInternalState
Callataskentryontheotherthread

Ada

ThreadPrioritization
SelectingaPrioritizationModel
pragmaLocking_Policy(Ceiling_Locking);

Ada

Establishingabasethreadpriority
pragmaPriority(expression);

Ada

ChangingTheadPriority
Set_Priority(Priority_Value);

Ada

setPriority(newPriority);

Java

ppriority:n

Smalltalk

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

106/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Threadsafesharingofdatawithoutsynchronization
Ensuringaccessisatomic
pragmaAtomic(Object_Name);

Ada

Ensuringaccessisalwaysviaalocalcopyoftheshareddata
pragmaVolatile(Object_Name);

Ada

Remarks
(1)introducedinSchemeinR6RS
(2)whenunused
(3)forC,itisnotastandardconvention,butitisthemorewidespread
(4)anystringliteralwouldwork
(5)seealso=head1,=head2,=over,etc
(6)need"file:%scriptheader.r"infileheader
(7)displayed<withaspecialcharacter
(8)variableontheright
(9)F#:withindentation
(10)thevariablebehaveslikeapointer
(11)cfhorizontallayout
(12)introducescope
(13)Smalltalk:introducescope
(14)asciirepresentation,originalusesaspecialcharset
(15)inModula2,<>and#aresynonyms
(16)===and!==differfrom==and!=whentheobjects'typediffer
(17)forobjects
(18)normal/structural/unification/arithmetic
(19)structural/mathematical
(20)deepcomparison
(21)inList::Util
(22)just'eval'evaluatesJavaScript
(23)Univoperator
(24)startingwithPHP5.3
(25)procedurecall
(26)inPliant,specialsugarforonlyoneparameter
(27)onlyforoneparameter
(28)onlyfortwoparameters
(29)fisablock
(30)Python>=2.5
(31)itdoesnotscaleto3rdargument
(32)lambda(x.y)...
(33)whencalleehasspecial"&"prototype
(34)thisisablock,notpreciselyafunction,butit'salike
(35)manualdeclarationoflocalvariableswantedintheclosure
(36)seealso:#1+#2&
(37)alsoworksforprocedures:proc{$AB}...end
(38)x,y,zaretheparameters
(39)methodisoptional
(40)inLua,"returnxxx"canonlyappearbeforeablockend.inMatlab,onlyininline('...')
(41)"return"isusedwhenthereisnovaluetoreturn
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

107/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

(42)inMatlab,onlyforanonymousfunction
(43)firefox
(44)C#4,onlyfor"dynamic"objects
(45)theresultgoesto"e"
(46)"break"saremandatory,evenfor"default"!
(47)Perl>=5.8.0
(48)1isoptionalinthisexample,sinceminis1bydefault
(49)inRuby,seealsocatch/throw
(50)oftenprovidedintheabbreviatedformcall/cc
(51)matchesanexpressionoftypet
(52)typeisinfered
(53)expression"e"iscasttothetypeof"v"
(54)forparameters
(55)quitebad:onlythereferenceisnonmutablewhereastheobjectisstillmutable
(56)eventualsend
(57)propertiesaresomethingalikeattributes,butreallyaremethods
(58)oneleveldepth
(59)generaldeepcopyfunction
(60)objectcloningisthedefault,usesthecopyconstructorinC++
(61)orsimplyo_:=ofornonpolymorphicobjects
(62)c'Classistheclassrootedinc
(63)seealsoisMemberOf
(64)assignmentattempt
(65)seealsocallable(obj.meth)forunboundmethods
(66)inPython,usuallycalledself
(67)":"isforexternalsymbolsonly,recommended
(68)directorynameispackagename
(69)ifnamesareexportedusing@EXPORT
(70)ifnamesarenotexportedorareexportedusing@EXPORT_OK
(71)deprecatedinANSICommonLisp,butusedinASDF
(72)usingacorrespondancefromthepackagenametothefilename
(73)insideafunction
(74)sincePHP5.3
(75)nospaces
(76)whenusingformat
(77)needexpandMacros
(78)whereTisthetypeofthevalue
(79)seealsocPickle
(80)butnotusingtheClike%syntax
(81)addinganendofline
(82)inBourneShell,addinganendofline
(83)addinganendoflineunlessalreadynewlineterminated
(84)fasterthanisEqual
(85)thestringisrepresentedonthestackas(addrlen)
(86)inLua>=5.0
(87)inC++,israngecheckedwhereasa[i]isnot
(88)ESIdialect
(89)bewareof0.0whichistrueinPike!
(90)Smalltalk:postfixoperator
(91)inModula2,"&"and"and"aresynonyms
(92)inOz,simplefunctions,notoperators
(93)newinPHP5.4
(94)restrictedtoinitialisationofalocalvariableinCandC++
(95)abcmustbeconstants
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

108/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

(96)beware,ifyougiveonlyoneintegerargument,itisthesize!
(97)forwriteaccess:aioput
(98)inC++,itisrangecheckedwhereasa[i]isnot.inSmalltalk,forwriteaccess:a:ati:puto
(99)seealsoHead
(100)listcomprehension
(101)notinstandard
(102)inC++,itisdoneinplace
(103)inScheme,notstandard,butnearlystandard
(104)theresultisnotguaranteedtobethesameastheorderintheinput
(105)inPerl,inList::Util
(106)BorlandextensioninPascal
(107)prefix
(108)postfix
(109)infix
(110)optionalvalueisonlyforpointers
(111)onlyfor"access"typesinAda
(112)introducedinPerl5.10
(113)attributeselector
(114)Java:introducedin1.5
(115)n1,n2,...
(116)returnsaniterator
(117)rightbias
(118)leftbias
(119)jotonBSD
(120)longisabiginteger
(121)fixedpoint
(122)0b1newinPHP5.4
(123)integersaredecimals
(124)withmathematicalpriorities
(125)APLusesarealmultiplicationsignformultiplicationfromaspecialcharacterset
(126)foreachvarioustypes
(127)frominstancesofAda.Numerics.Float_RandomorAda.Numerics.Discrete_Random
(128)Ruby>=1.7
(129)replaceFloatwithwhatevertypeyouareusing
(130)inmoduleData.Bits
(131)seealsobitand/bitor/bitxor
(132)seealsobitnot
(133)equivalenttonewProcess+resume
(134)"stop"isnowdeprecated
(135)athreadiscreatedfromablock,whichisaclosureonthevariablesasseenbytheblock

SimilarPages
Belorussiantranslationofthispage
Comparisonofprogramminglanguagessyntax
CommentsandLiteralsinprogramminglanguages
TheSurfaceofProgrammingLanguages
Delphi,VisualBasic,C++,Java
SML,OCaml
Java,C++,Smalltalk
Java,C#
Java,C#
Ruby,Java,Perl
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

109/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Python,Perl
Python,Lisp
PL/I,C
Perl,PHP
EmacsLisp,Perl
Smalltalk,Lisp
Tasksinmanylanguages

References
BCPL
Eiffel
SQL

Credits
Yoann'Pad'Padioleau(Haskelladditions,Beta,variousfixes)
JakubTravnik(Pascal,DelphiKylix)
RobertFeldt(Rubyadditions)
PascalTerjan(PHP)
Carlos'angus'(PostScript)
AxelKittenberger(various)
GuidovanRossum(blockvsscoping)
JeffreyHobbs(Tcl)
MarkJasonDominus(SML,various)
AshSearle(Java,PHP,JavaScript)
MarkS.Miller(E)
PeteJinks(various)
SteveTolkin(various)
FranckArnaud(Eiffel)
TomMurphy(SML)
GuySteele(Fortran,andmanyvarious)
CarlGay(Dylan,CommonLisp)
Jaynop@nop.com(Lua)
PhilippeLhoste(Lua,JavaScript)
JimRogers(Ada,Java,Threadssection)
KetilZ.Malde(Haskell)
MarkCarroll(Modula3)
KeithWansbrough(HaskellandafewSML)
RemiVanicat(OCaml)
MatthieuVilleneuve(CommonLisp)
JoachimDurchholz(Eiffel)
WalterVannini(C,"breakinglines"idea)
PeterLewerin(Tcl)
PatriceOssonadeMendez(Pliant)
BertFreudenberg(Smalltalk&Squeakadditionscorrections)
DennisHaney(Perl,C#)
FergusHenderson(Mercury)
RalphBecket(Mercury)
BillThornton(Java)
NikCrabtree(C#)
NealHoltz(Python)
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

110/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

DonaldChai(Python)
FredSpiessens(Oz)
MartinNilsson(Pike)
TheodoreEastman(VisualBasic)
GeorgeHerson(Eiffel)
LeeDenison(Tcl)
AntonRolls(Rebol)
Pedro(Lua)
NathanSharfi(C99,C#,C++)
DirkGerrits(CommonLisp,Scheme,EmacsLisp)
TabithaArrowny(Ruby,Python,Perl,...)
PterVarga(BourneShell,CommonLisp,...)
IanHenderson(ObjectiveC)
AnthonyBorla(ClassicREXX,Prolog,Logo)
PaulMcJones(Modula3fixes)
UweKolb(Smalltalkfixes)
CiaranMcNulty(PHP)
DavidB.Nagle(Yorick)
MichaelSchaufelberger(Eiffel)
SamuelCharron(Erlang)
KyleRoss(OCaml)
DamienKrotkine(Ruby)
GuillaumeCottenceau(Java)
David.Whitten(MUMPS)
PhilHoward(various)
AndrzejZawadzki(Ruby)
StuartBrady(VisualBasic)
JorisGillis(Maple)
GarrettWollman(Ruby,BourneShell,C...)
ClausGittinger(Smalltalk)
Bobby'nneonneo'Xiao(Python)
MichaelSchlenker(Tcl)
AlexVondrak(Python)
DanielLaberge(Pascal)
DanielWagner(Haskell)
BobBane(CommonLisp)
AlanHogan(Java)
SteveDavison(C)
KonstantinYegupov(PHP,Python...)
NoRubinstein(Io,CoffeeScript)
FlorentinMillour(Yorick)
AxelLiljencrantz(FishShell)
SanghyeonSeo(Lua)
SzabolcsHorvt(Mathematica)
LaurentLeBrun(F#,GNUsed)
JulienHall(Smalltalk)
IanOsgood(Forth)
DmitryA.Kazakov(Ada)
PeterHermann(Ada)
IanJackson(Tcl,Perl,C,Assembler...)
SteveBreese
NilsMHolm(Scheme,...)
StasMalyshev(PHP5)
http://rigaux.org/languagestudy/syntaxacrosslanguages.html

111/112

9/16/2016

syntaxacrosslanguages(OneBigPage)

Pixel
ThisdocumentislicensedunderGFDL(GNUFreeDocumentationLicense).
Generatedfromsyntaxacrosslanguages.html.pl
$Id:syntaxacrosslanguages.html.pl4082008082908:32:23Zpixel$

http://rigaux.org/languagestudy/syntaxacrosslanguages.html

112/112

Вам также может понравиться