Поређење програмских језика (основне инструкције)
Поређење програмских језика (основна упутства) Поређење програмских језика је уобичајена тема разговора међу софтверским инжењерима . Неколико основних упутстава програмских језика су овде.
Конвенције овог чланка
bold је буквално код. Не-болд је тумачио читалац. Изјаве у знаковима су опционе (« … »). Tab ↹ указује на неопходну алинеју (са размаком).
Тип идентификатора
8 бајтова (бајт )
16 бајтова (мањи број )
32 бајтова
64 бајтова (дужи број )
Дужина речи
Произвољно прецизни (bignum )
Потписано
Непотписано
Потписано
Непотписано
Потписано
Непотписано
Потписано
Непотписано
Потписано
Непотписано
Ада [ 1]
range -2**7 .. 2**7 - 1 [j]
range 0 .. 2**8 - 1 [j] или mod 2**8 [k]
range -2**15 .. 2**15 - 1 [j]
range 0 .. 2**16 - 1 [j] или mod 2**16 [k]
range -2**31 .. 2**31 - 1 [j]
range 0 .. 2**32 - 1 [j] или mod 2**32 [k]
range -2**63 .. 2**63 - 1 [j]
mod 2**64 [k]
Integer [j]
range 0 .. 2**Integer' Size - 1 [j] или mod Integer' Величина [k]
Н/Д
ALGOL 68 (променљиве ширине)
мали int [c]
Н/Д
мали int [c]
Н/Д
int [c]
Н/Д
велики int [c]
Н/Д
int [c]
Н/Д
велики int [a] [g]
бајтови & битови
C (C99 фиксне ширине)
int8_t
uint8_t
int16_t
uint16_t
int32_t
uint32_t
int64_t
uint64_t
int
непотписан int
Н/Д
C++ (С++11 ) фиксне ширине)
C (C99 variable-width)
потписан чађ
непотписан чађ
кратак [c]
непотписан кратак [c]
велики [c]
непотписан велики [c]
велики [c]
непотписан велики [c]
C++ (C++11 променљиве ширине)
Objective-C (Cocoa )
потписан чађ или int8_t
непотписан чађ или uint8_t
кратак или int16_t
непотписан кратак или uint16_t
int или int32_t
непотписан int или uint32_t
дугачак или int64_t
непотписан дугачак или uint64_t
NSInteger или дугачак
NSUInteger или непотписан дуг
C#
sbyte
byte
short
ushort
int
uint
long
ulong
IntPtr
UIntPtr
System.Numerics .BigInteger (.NET 4.0)
Јава
byte
Н/Д
char [b]
Н/Д
Н/Д
Н/Д
Н/Д
java.math .BigInteger
Гоу
int8
uint8 or byte
int16
uint16
int32
uint32
int64
uint64
int
uint
big.Int
Свифт
Int8
UInt8
Int16
UInt16
Int32
UInt32
Int64
UInt64
Int
UInt
D
byte
ubyte
short
ushort
int
uint
long
ulong
Н/Д
Н/Д
BigInt
Common Lisp [ 2]
bignum
Шема
ISLISP [ 3]
bignum
Паскал (Слободан Паскал )
shortint
byte
smallint
word
longint
longword
int64
qword
integer
cardinal
Н/Д
Вижуал бејсик
Н/Д
Byte
Integer
Н/Д
Long
Н/Д
Н/Д
Н/Д
Н/Д
Visual Basic .NET
SByte
Short
UShort
Integer
UInteger
Long
ULong
System.Numerics .BigInteger (.NET 4.0)
FreeBASIC
Byte or Integer<8>
UByte or UInteger<8>
Short or Integer<16>
UShort or UInteger<16>
Long or Integer<32>
ULong or UInteger<32>
LongInt or Integer<64>
ULongInt or UInteger<64>
Integer
UInteger
Н/Д
Пајтон 2.x
Н/Д
Н/Д
Н/Д
Н/Д
int
Н/Д
long
Python 3.x
Н/Д
Н/Д
Н/Д
Н/Д
Н/Д
int
S-Lang
Н/Д
Н/Д
Н/Д
Н/Д
Н/Д
Н/Д
Фортран
INTEGER (KIND = n) [f]
Н/Д
INTEGER (KIND = n) [f]
Н/Д
INTEGER (KIND = n) [f]
Н/Д
INTEGER (KIND = n) [f]
Н/Д
PHP
Н/Д
Н/Д
int [m]
Н/Д
int [m]
Н/Д
Н/Д
[e]
Перл 5
Н/Д [d]
Н/Д [d]
Н/Д [d]
Н/Д [d]
Н/Д [d]
Math::BigInt
Перл 6
int8
uint8
int16
uint16
int32
uint32
int64
uint64
Int
Н/Д
Руби
Н/Д
Н/Д
Н/Д
Н/Д
Fixnum
Н/Д
Bignum
Ерланг
Н/Д
Н/Д
Н/Д
Н/Д
integer()
Н/Д
integer()[o]
Скала
Byte
Н/Д
Short
Char [l]
Int
Н/Д
Long
Н/Д
Н/Д
Н/Д
scala.math.BigInt
Seed7
Н/Д
Н/Д
Н/Д
Н/Д
Н/Д
Н/Д
integer
Н/Д
Н/Д
Н/Д
bigInteger
Smalltalk
Н/Д
Н/Д
Н/Д
Н/Д
SmallInteger [i]
Н/Д
LargeInteger [i]
Windows PowerShell
Н/Д
Н/Д
Н/Д
Н/Д
Н/Д
Н/Д
OCaml
Н/Д
Н/Д
int32
Н/Д
int64
Н/Д
int or nativeint
open Big_int;; big_int
F Sharp
sbyte
byte
int16
uint16
int32 or int
uint32
uint64
nativeint
unativeint
bigint
Standard ML
Н/Д
Word8.word
Н/Д
Int32.int
Word32.word
Int64.int
Word64.word
int
word
LargeInt.int or IntInf.int
Haskell (GHC )
«import Int » Int8
«import Word » Word8
«import Int » Int16
«import Word » Word16
«import Int » Int32
«import Word » Word32
«import Int » Int64
«import Word » Word64
Int
«import Word » Word
Integer
Ајфел
INTEGER_8
NATURAL_8
INTEGER_16
NATURAL_16
INTEGER_32
NATURAL_32
INTEGER_64
NATURAL_64
INTEGER
NATURAL
Н/Д
Кобол [h]
BINARY-CHAR «SIGNED»
BINARY-CHAR UNSIGNED
BINARY-SHORT «SIGNED»
BINARY-SHORT UNSIGNED
BINARY-LONG «SIGNED»
BINARY-LONG UNSIGNED
BINARY-DOUBLE «SIGNED»
BINARY-DOUBLE UNSIGNED
Н/Д
Н/Д
Н/Д
Mathematica
Н/Д
Н/Д
Н/Д
Н/Д
Н/Д
Integer
Wolfram
Н/Д
Н/Д
Н/Д
Н/Д
Н/Д
Integer
^a стандарне Стандардне константе кратко int и int дужине могу да се користе за одређивање колико 'кратких и' дугих и могу бити корисне префиксима за 'кратак int' и 'дуг int'. Стварна величина 'кратког int', 'int' и 'дугог int' је доступна као кратке константе max int, max int и long max int итд.^b Обично се користи за знакове .
^c ALGOL 68, C и C++ језици не прецизирају тачну ширину врсте целобројних вредности short, int, long, и (C99, C++11) long long, тако да су имплементације-зависне. У C и C++ short, long, и long long типови се захтевају да буду најмање 16, 32, и 64 бита, али не могу бити већи. Тип int је потребно да буде бар исто толико широк као short и највише широк као long, и обично ширина величине речи у процесору машине (нпр на 32-битном машину је често 32 бита; на 64-битним машинама често је на 64 бита). С99 и C++ 11 је такође дефинисан са [u]intN_t тачне ширине врсте у stdint.h хедеру.
^d Perl 5 нема различитих типова. Цели бројеви, децимални, стрингови, итд се сматрају "скаларима".
^e PHP има два произвољно-прецизне библиотеке. BCMath библиотека користи само стрингове као што су datatype. GMP библиотка користи интерни "ресурс" тип.
^f Вредност "n" је обезбеђена SELECTED_INT_KIND SELECTED_INT_KIND [ 4] унутрашњом функцијом.
^g ALGOL 68Gниз опција времена --precision "number" е може подесити precision long long ints до жељеног "броја" значајних цифара. Стандардне константе long long int width и long long max int могу бити коришћене за одређивање стварне прецизности.
^h COBOL омогућава спецификацију потребне прецизности и аутоматски ће одабрати доступан тип који је способан да представља одређену прецизност. "PIC S9999", на пример, је био потребан за потписавање четири променљивих децималних цифара прецизности. Ако је наведено као бинарно поље, то би се изабрало 16 битним типом на већини плат форми.
^i Smalltalk аутоматски бира одговарајућу заступљеност интегралних бројева. Типично, две репрезентације су присутне, једна за целе бројева се уклапа у природну величину реч минус (SmallInteger) и једна подржава произвољне величине целих бројева (LargeInteger). Аритметичке операције су подржане полиморфним аргументима и враћају резултат на најадекватније компактне репрезентације.
^j Ada опсег проверава граничне прекршаје у run-time (као и на компајлирању статичких израза). run time граница кршења подиже "ограничење грешке" изузетак. Опсег није ограничен на степену два. Обично предефинисани целобројни подтипови су:Positive (range 1 .. Integer'Last) and Natural (range 0 .. Integer'Last). Short_Short_Integer (8 бајтова), Short_Integer (16 бајтова) and Long_Integer (64 бајтова) су такође предефинисане, али не захтевају Ада стандарде. Run time чекови се могу искључити уколико је учинак важнија од интегритета провере.
^k Adамодуло типови спроводе по модулу аритметике у свим операцијама, односно нема могућих кршења домета. Модули нису ограничени на овлашћења два.
^l Обично се користи за типове попут Јава знака.
^m int int у PHP има исту ширину као long type у C коју он има на том систему [c] .^n Erlang динамички куца. Тип идентификатора су се обично користи за спецификацију врсте рекордног поља и аргумента и враћа врсте функција.[ 5]
^o Када прелази једну реч.[ 6]
Једнострука тачност
Двострука тачност
Друга тачност
Зависни процесор
Ада [ 1]
Float
Long_Float
Н/Д
ALGOL 68
real [a]
long real [a]
short real , long long real , etc.[d]
C
float [b]
double
long double [f]
C++ (STL)
Objective-C (Cocoa)
CGFloat
C#
float
Н/Д
Јава
Гоу
float32
float64
Swift
Float
Double
CGFloat
D
float
double
real
Common Lisp
Шема
ISLISP
Паскал (слободан Паскал)
single
double
real
Visual Basic
Single
Double
Н/Д
Visual Basic .NET
Xojo
Пајтон
Н/Д
float
JavaScript
Number [ 7]
Н/Д
S-Lang
Фортран
REAL(KIND = n) [c]
PHP
float
Перл
Перл 6
num32
num64
Num
Руби
Н/Д
Float
Н/Д
Скала
Float
Double
Seed7
Н/Д
float
Smalltalk
Float
Double
Windows PowerShell
OCaml
Н/Д
float
Н/Д
F#
float32
Standard ML
Н/Д
real
Haskell (GHC)
Float
Double
Ајфел
REAL_32
REAL_64
КОБОЛ
FLOAT-BINARY-7 [e]
FLOAT-BINARY-34 [e]
FLOAT-SHORT , FLOAT-LONG , FLOAT-EXTENDED
Mathematica
Н/Д
Н/Д
Real
^a Стандардне константе real shorts и real lengths се могу користити за одређивање 'short и 'long и за поправљање 'short real ' и 'long real '. Актуелне величине 'short real ', 'real ' и 'long real ' су доступне као константе short max real , max real и long max real etc. Са константама short small real , small real и long small real доступни су разни типови епсилон машина .^b декларације просте прецизности се често не поштују^c Вредност "n" је обезбеђена SELECTED_REAL_KIND [ 8] унутрашњом функцијом.^d ALGOL 68G 's run time опција оже се подесити прецизним long long reals до обезбеђења "number" значајних цифара. Стандардне константе long long real width и 'long long max real могу се користити за одређивање стварне прецизност. ^e IEEE децимални тип ће бити уведен следећим COBOL стандардом. ^f Исте величине као 'double' на многим имплементацијама.
Integer
Једнострука тачност
Двострука тачност
Пола и четвртна прецизност итд.
Ада [ 1]
Н/Д
Комплексан [b]
Комплексан [b]
Комплексан [b]
ALGOL 68
Н/Д
compl
long compl etc.
short compl etc. & long long compl etc.
C (C99)[ 9]
Н/Д
децимални комплексан
двоструко комплексан
Н/Д
C++ (STL)
Н/Д
std::complex<float>
std::complex<double>
C#
Н/Д
Н/Д
System.Numerics.Complex (.Net 4.0)
Java
Н/Д
Н/Д
Н/Д
Гоу
Н/Д
complex64
complex128
D
Н/Д
cfloat
cdouble
Objective-C
Н/Д
Н/Д
Н/Д
Common Lisp
Шема
Паскал
Н/Д
Н/Д
Visual Basic
Н/Д
Н/Д
Visual Basic .NET
Н/Д
Н/Д
System.Numerics.Complex (.Net 4.0)
Перл
Math::Complex
Перл 6
complex64
complex128
Complex
Пајтон
complex
Н/Д
JavaScript
Н/Д
Н/Д
S-Lang
Н/Д
Н/Д
Фортран
COMPLEX(KIND = n) [a]
Руби
Complex
Н/Д
Complex
Скала
Н/Д
Н/Д
Н/Д
Seed7
Н/Д
Н/Д
complex
Smalltalk
Complex
Complex
Complex
Windows PowerShell
Н/Д
Н/Д
OCaml
Н/Д
Н/Д
Complex.t
F#
System.Numerics.Complex (.Net 4.0)
Standard ML
Н/Д
Н/Д
Н/Д
Haskell (GHC)
Н/Д
Complex.Complex Float
Complex.Complex Double
Ајфел
Н/Д
Н/Д
Н/Д
КОБОЛ
Н/Д
Н/Д
Н/Д
Mathematica
Complex
Н/Д
Н/Д
Complex
^a Вредност "n" је обезбеђена SELECTED_REAL_KIND[ 8] унутрашњом функцијом.
^b Општи тип који се може инстанцирати са било којим базним флоат типом.
Остале врсте баријабли
Текст
Булов тип података
Набрајање
Објекат /Универзални
Знак
Ниска [a]
Ада [ 1]
Character
String & Bounded_String & Unbounded_String
Boolean
(item1 , item2 , ... )
tagged null record
ALGOL 68
char
string & bytes
bool & bits
Н/Д - User defined
Н/Д
C (C99)
char wchar_t
Н/Д
bool [b]
enum «name» { item1 , item2 , ... };
void *
C++ (STL)
«std::» string
Objective-C
unichar
NSString *
BOOL
id
C#
char
string
bool
enum name { item1 , item2 , ... }
object
Java
String
boolean
Object
Гоу
byte rune
string
bool
const (item1 = iota item2 ... )
interface{}
Swift
Character
String
Bool
enum name { case item1 , item2 , ... }
Any
D
char
string
bool
enum name {item1 , item2 , ... }
std.variant.Variant
Common Lisp
Шема
ISLISP
Паскал (ISO)
char
Н/Д
boolean
(item1 , item2 , ... )
Н/Д
Објекат Паскал (Делфи)
string
variant
Visual Basic
Н/Д
String
Boolean
Enum name item1 item2 ... End Enum
Variant
Visual Basic .NET
Char
Object
Xojo
Н/Д
Object or Variant
Пајтон
Н/Д [d]
str
bool
object
JavaScript
Н/Д [d]
String
Boolean
Object
S-Lang
Фортран
CHARACTER(LEN = *)
CHARACTER(LEN = :), allocatable
LOGICAL(KIND = n) [f]
CLASS(*)
PHP
Н/Д [d]
string
bool
(type declaration omitted)
Перл
Н/Д [d]
УНИВЕРЗАЛНИ
Перл 6
Char
Str
Bool
enum name <item1 item2 ... > or enum name <<:item1 (value ) :item2 (value ) ... >>
Mu
Руби
Н/Д [d]
String
Object [c]
Object
Скала
Char
String
Boolean
object name extends Enumeration { val item1 , item2 , ... = Value }
Any
Seed7
char
string
boolean
const type : name is new enum item1 , item2 , ... end enum;
Windows PowerShell
OCaml
char
string
bool
Н/Д [e]
Н/Д
F#
type name = item1 = value | item2 = value | ...
obj
Standard ML
Н/Д [e]
Н/Д
Haskell (GHC)
Char
String
Bool
Н/Д [e]
Н/Д
Ајфел
CHARACTER
STRING
BOOLEAN
Н/Д
ANY
КОБОЛ
PIC X
PIC X(string length ) or PIC X«X...»
PIC 1«(number of digits )» or PIC 1«1...»
Н/Д
OBJECT REFERENCE
Mathematica
Н/Д [d]
String
Н/Д
^a конкретно, управља низовима произвољне дужине аутоматски.
^b Овај језик представља булеан као цео број где лажно представља вредност од нуле и истину од не-нула вредности.
^c Све вредности су или тачне или нетачне. Све TrueClass једнакости тачности и све FalseClass једнакости нетачности.
^d Овај језик нема посебан тип знакова. Знакови су представљени као стрингови дужине 1.
^e Набрајања на овом језику су алгебарске врсте само са нулари конструкторима
^f Вредност "n" је обезбеђена SELECTED_INT_KIND [ 4] унутрашњом функцијом.
Изведене врсте
Фиксна величина низа
динамичка величина низа
једнодимензионални низ
вишедимензионални низ
једнодимензионални низ
вишедимензионални низ
Ада [ 1]
array ( <first> .. <last>) of <type> orarray ( <discrete_type>) of <type>
array ( <first1 > .. <last1 >, <first2 > .. <last2 >, ...) of <type> orarray ( <discrete_type1 >, <discrete_type2 >, ...) of <type>
array ( <discrete_type> range <>) of <type>
array ( <discrete_type1 > range <>, <discrete_type2 > range <>, ...) of <type>
ALGOL 68
[first :last ] «modename» or simply:[size ] «modename»
[first1 :last1 , first2 :last2 ] «modename» or[first1 :last1 ][first2 :last2 ] «modename» etc.
flex [first :last ] «modename» or simply:flex [size ] «modename»
flex [first1 :last1 , first2 :last2 ] «modename» orflex [first1 :last1 ]flex [first2 :last2 ] «modename» etc.
C (C99)
type name[ size] [a]
type name[ size1 ][ size2 ] [a]
type * name or within a block:int n = ...; type name[ n]
C++ (STL)
«std::»array < type, size> (C++11)
«std::»vector < type>
C#
type[]
type[,, ...]
System .Collections .ArrayList orSystem .Collections .Generic .List < type>
Java
type[] [b]
type[][] ...[b]
ArrayList or ArrayList< type>
D
type[ size]
type[ size1 ][ size2 ]
type[]
Гоу
[ size] type
[ size1 ][ size2 ] ...type
[]type
[][]type
Swift
[ type] or Array< type>
[[ type]] or Array<Array< type>>
Objective-C
NSArray
NSMutableArray
JavaScript
Н/Д
Н/Д
Array [d]
Common Lisp
Шема
ISLISP
Паскал
array[ first.. last] of type[c]
array[ first1 .. last1 ] of array[ first2 .. last2 ] ... of type [c]
or
array[ first1 .. last1 , first2 .. last2 , ...] of type [c]
Н/Д
Н/Д
Објекат Паскал (Delphi)
array of type
array of array ... of type
Visual Basic
Visual Basic .NET
System .Collections .ArrayList orSystem .Collections .Generic .List (Of type)
Пајтон
list
S-Lang
Фортран
type :: name( size)
type :: name( size1 , size2 ,...)
type, ALLOCATABLE :: name(:)
type, ALLOCATABLE :: name(:,:,...)
PHP
array
Перл
Перл 6
Array[ type] or Array of type
Руби
Array
Скала
Array[ type]
Array[ ...[Array[ type]] ...]
ArrayBuffer[ type]
Seed7
array type orarray [ idxType] type
array array type orarray [ idxType] array [ idxType] type
array type orarray [ idxType] type
array array type orarray [ idxType] array [ idxType] type
Smalltalk
Array
OrderedCollection
Windows PowerShell
type[]
type[,, ...]
OCaml
type array
type array ... array
F#
type [] or type array
type [,, ...]
System .Collections .ArrayList orSystem .Collections .Generic .List < type>
Standard ML
type vector or type array
Haskell (GHC)
КОБОЛ
level-number type OCCURS size «TIMES ».
one-dimensional array definition...
level-number type OCCURS min-size TO max-size «TIMES » DEPENDING «ON » size. [e]
Н/Д
^a У већини израза (осим sizeof и & оператора), вредности низа типа у C се аутоматски претварају у показивача свог првог аргумента.
^b C-like "type x[] "ради у Java, како год "type[] x " је пожељан облик низа декларације.
^c Subranges се користи за дефинисање границе низа.
^d JavaScript низови су посебна врста објекта.
^e The DEPENDING ON
услов у COBOL не ствара за "тачну" променљиву дужине низа и увек ће издвојити максималну величину низа.
Други типови
Једносложни типови
Алгебарски типови података
Веза
Запис
Листа
Ада [ 1]
type identifier is «abstract » «tagged » «limited » [record
fieldname1 : type;
fieldname2 : type; ...
end record |
null record ]
Н/Д
Any combination of records, unions and enumerations (as well as references to those, enabling recursive types).
type identifier ( variation : discrete_type) is record
case variation is
when choice_list1 =>
fieldname1 : type;
...
when choice_list2 =>
fieldname2 : type;
...
...
end case; end record
ALGOL 68
struct (modename «fieldname» , ... );
Required types and operators can be user defined
union (modename , ... );
C (C99)
struct «name» { type name; ...};
Н/Д
Н/Д
union { type name; ...};
Objective-C
C++
struct «name» { type name; ...}; [b]
«std::»tuple <type1 ..typen >
C#
struct name { type name; ...}
Н/Д
Java
Н/Д [a]
JavaScript
Н/Д
D
struct name { type name; ...}
std.variant.Algebraic !(type,...)
union { type name; ...}
Гоу
struct { «name» type ...}
Swift
struct name { var name «: type» ...}
( «name1 : » val1 , «name2 : » val2 , «name3 : » val3 , ... )
enum name { case Foo«( types) » case Bar «( types) » ... }
Common Lisp
(cons val1 val2 ) [c]
Scheme
Н/Д
ISLISP
Паскал
record name: type; ... end
Н/Д
Н/Д
record case type of value: ( types); ...end
Visual Basic
Visual Basic .NET
Structure name Dim name As type ... End Structure
Пајтон
Н/Д [a]
«( »val1 , val2 , val3 , ... «) »
Н/Д
S-Lang
struct { name [=value], ...}
Фортран
TYPE name type :: name ... END TYPE
PHP
Н/Д [a]
Перл
Н/Д [d]
Н/Д
Перл 6
Н/Д [a]
Руби
OpenStruct . new ({ :name => value })
Скала
case class name( «var » name: type, ...)
( val1 , val2 , val3 , ... )
abstract class name
case class Foo( «parameters») extends name
case class Bar( «parameters») extends name
...
or
abstract class name
case object Foo extends name
case object Bar extends name
...
or combination of case classes and case objects
Windows PowerShell
OCaml
type name = { «mutable » name : type; ...}
«( »val1 , val2 , val3 , ... «) »
type name = Foo «of type» | Bar «of type» | ...
Н/Д
F#
Standard ML
type name = { name : type, ...}
( val1 , val2 , val3 , ... )
datatype name = Foo «of type» | Bar «of type» | ...
Haskell
data Name = Constr { name :: type, ...}
data Name = Foo «types» | Bar «types» | ...
КОБОЛ
level-number name type clauses.
level-number+n name type clauses.
...
Н/Д
Н/Д
name REDEFINES variable type.
^a Подржане су само класе.
^b struct
s У C++ СУ заправо класе, али су подразумеване у јавности и такође ПОД објекти. C++11 је додатно проширен, како би настало деловање идентичног ПОД објекта у многим случајевима ^c Само пар
^d Иако Перл нема евиденцију, јер је тип система који омогућава различите врсте података у низу, "hashes" (асоцијативни низови) немају променљиви индекс који ће ефикасно бити исти као и евиденције.
^e Набрајања на овом језику су алгебарске врсте са само нулари конструкторима
Варијабиле и константе декларације
варијабле
константе
тип синонима
Ада [ 1]
identifier : type «:= initial_value»[e]
identifier : constant type := final_value
subtype identifier is type
ALGOL 68
modename name «:= initial_value»;
modename name = value;
mode synonym = modename ;
C (C99)
type name «= initial_value»;
enum{ name = value };
typedef type synonym;
Objective-C
C++
const type name = value;
C#
type name «= initial_value»; or var name = value;
const type name = value; or readonly type name = value;
using synonym = type;
D
type name «= initial_value»; or auto name = value;
const type name = value; or immutable type name = value;
alias type synonym;
Java
type name «= initial_value»;
final type name = value;
Н/Д
JavaScript
var name «= initial_value»;
const name = value;
Гоу
var name type «= initial_value» or name := initial_value
const name «type» = value
type synonym type
Swift
var name «: type» «= initial_value»
let name «: type» = value
typealias synonym = type
Common Lisp
(defparameter name initial_value) or (defvar name initial_value) or (setf (symbol-value ' symbol) initial_value)
(defconstant name value)
(deftype synonym () ' type)
Шема
(define name initial_value)
ISLISP
(defglobal name initial_value) or (defdynamic name initial_value)
(defconstant name value)
Н/Д
Pascal[a]
name: type «= initial_value»
name = value
synonym = type
Visual Basic
Dim name As type
Const name As type = value
Visual Basic .NET
Dim name As type«= initial_value»
Imports synonym = type
Xojo
Dim name As type«= initial_value»
Н/Д
Пајтон
name = initial_value
Н/Д
synonym = type[b]
CoffeeScript
Н/Д
S-Lang
name = initial_value;
typedef struct {...} typename
Фортран
type name
type, PARAMETER :: name = value
PHP
$ name = initial_value;
define(" name", value); const name = value (5.3+)
Н/Д
Перл
«my » $ name «= initial_value»; [c]
use constant name => value;
Перл 6
«my «type»» $name «= initial_value»; [c]
«my «type»» constant name = value;
:: synonym ::= type
Руби
name = initial_value
Name = value
synonym = type[b]
Скала
var name«: type» = initial_value
val name«: type» = value
type synonym = type
Windows PowerShell
«[ type] » $ name = initial_value
Н/Д
Н/Д
Bash shell
name= initial_value
Н/Д
Н/Д
OCaml
let name «: type ref » = ref value[d]
let name «: type» = value
type synonym = type
F#
let mutable name «: type» = value
Standard ML
val name «: type ref » = ref value[d]
val name «: type» = value
Haskell
«name:: type; » name = value
type Synonym = type
Forth
VARIABLE name (in some systems use value VARIABLE name instead)
value CONSTANT name
КОБОЛ
level-number name type clauses.
«0 »1 name CONSTANT «AS » value.
level-number name type clauses «IS » TYPEDEF.
Mathematica
name= initialvalue
Н/Д
Н/Д
^a Паскал има декларацију блокова.
^b Типови су само редовни објекти, тако да можете само да их доделите.
^c У Перлу, "my" кључна реч сцопес је променљива у блоку.
^d Технички, то не изјашњава име да буде променљива променљива у МЛ, сви називи могу бити везани само једном; уместо тога, он изјављује име до тачке на структури "референтног" податка, која је једноставна променљиво колона. Структура података се онда може читати и писати користећи ! и := операторе.
^[e] . Ако нема почетне вредности, основна вредност се аутоматски додељује (коју ће изазвати Рун-тиме изузетак ако се користи пре него што важи вредност која је додељена). Иако се овакво понашање може потиснути препоручљиво је у интересу предвидљивости. Ако нема неважећих вредности може се наћи за тип (на пример у случају несметано типа интегер), ваљана, али предвидљива вредност је изабрана уместо тога.
ако
ако и само ако
switch искази
условни искази
Ада [ 1]
if condition then statements «else statements» end if
if condition1 then statements elsif condition2 then statements ... «else statements» end if
case expression is when value_list1 => statementswhen value_list2 => statements ...«when others => statements» end case
(if condition1 then expression1 «elsif condition2 then expression2 » ... else expressionn ) (case expression is when value_list1 => expression1 when value_list2 => expression2 ... «when others => expressionn » )
Seed7
case expression of when set1 : statements ... «otherwise: statements» end case
Modula-2
if condition then statements «else statements» end
if condition1 then statements elsif condition2 then statements ... «else statements» end
case expression of caseLabelList : statements | ... «else statements» end
ALGOL 68 & "brief form"
if condition then statements «else statements» fi
if condition then statements elif condition then statements fi
case switch in statements, statements«,... out statements» esac
( condition | valueIfTrue | valueIfFalse )
( condition | statements «| statements» )
( condition | statements |: condition | statements )
( variable | statements,... «| statements» )
C (C99)
if ( condition) { instructions} «else { instructions} »
if ( condition) { instructions} else if ( condition) { instructions} ... «else { instructions} »
switch ( variable) { case case1: instructions «break; » ... «default: instructions»}
condition ? valueIfTrue : valueIfFalse
Objective-C
C++ (STL)
D
Java
JavaScript
PHP
C#
switch ( variable) { case case1: instructions; «jump statement; » ... «default: instructions; «jump statement; »» }
Windows PowerShell
if ( condition) { instructions } elseif ( condition) { instructions } ... «else { instructions } »
switch ( variable) { case1 { instructions «break; » } ... «default { instructions } »}
Go
if condition { instructions} «else { instructions} »
if condition { instructions} else if condition { instructions} ... «else { instructions} » or switch { case condition: instructions ... «default: instructions»}
switch variable { case case1: instructions ... «default: instructions»}
Swift
if condition { instructions} «else { instructions} »
if condition { instructions} else if condition { instructions} ... «else { instructions} »
switch variable { case case1: instructions ... «default: instructions»}
Перл
if ( condition) { instructions} «else { instructions} » orunless ( notcondition) { instructions} «else { instructions} »
if ( condition) { instructions} elsif ( condition) { instructions} ... «else { instructions} » orunless ( notcondition) { instructions} elsif ( condition) { instructions} ... «else { instructions} »
use feature "switch"; ...given ( variable) { when ( case1) { instructions } ... «default { instructions } »}
condition ? valueIfTrue : valueIfFalse
Перл 6
if condition { instructions} «else { instructions} » orunless notcondition { instructions}
if condition { instructions} elsif condition { instructions} ... «else { instructions}
given variable { when case1 { instructions } ... «default { instructions } »}
condition ?? valueIfTrue !! valueIfFalse
Руби
if condition instructions «else instructions»
if condition instructions elsif condition instructions ... «else instructions» end
case variable when case1 instructions ... «else instructions» end
condition ? valueIfTrue : valueIfFalse
Скала
if ( condition) { instructions} «else { instructions} »
if ( condition) { instructions} else if ( condition) { instructions} ... «else { instructions} »
expression match { case pattern1 => expressioncase pattern2 => expression ... «case _ => expression»} [b]
if ( condition) valueIfTrue else valueIfFalse
Smalltalk
condition ifTrue: trueBlock «ifFalse: falseBlock» end
condition ifTrue: trueBlock ifFalse: falseBlock
Common Lisp
(when condition instructions) or (unless condition instructions) or (if condition(progn instructions) «(progn instructions) »)
(cond ( condition1 instructions) ( condition2 instructions) ... «(t instructions) »)
(case expression( case1 instructions) ( case2 instructions) ... «(otherwise instructions) »)
(if condition valueIfTrue valueIfFalse)
Шема
(when conditioninstructions) or (if condition (begin instructions) «(begin instructions) »)
(cond ( condition1 instructions) ( condition2 instructions) ... «(else instructions) »)
(case ( variable) (( case1) instructions) (( case2) instructions) ... «(else instructions) »)
ISLISP
(if condition(progn instructions) «(progn instructions) »)
(cond ( condition1 instructions) ( condition2 instructions) ... «(t instructions) »)
(case expression( case1 instructions) ( case2 instructions) ... «(t instructions) »)
(if condition valueIfTrue valueIfFalse)
Паскал
if condition then begin instructions end «else begin instructions end »[c]
if condition then begin instructions end else if condition then begin instructions end ... «else begin instructions end »[c]
case variable of case1: instructions ... «else: instructions» end [c]
Visual Basic
If condition Then instructions «Else instructions» End If
If condition Then instructions ElseIf condition Then instructions ... «Else instructions» End If
Select Case variable Case case1 instructions ... «Case Else instructions» End Select
IIf ( condition, valueIfTrue, valueIfFalse)
Visual Basic .NET
If( condition, valueIfTrue, valueIfFalse)
Xojo
Пајтон [a]
if condition : Tab ↹ instructions «else: Tab ↹ instructions»
if condition : Tab ↹ instructions elif condition : Tab ↹ instructions ... «else: Tab ↹ instructions»
valueIfTrue if condition else valueIfFalse (Python 2.5+)
S-Lang
if ( condition) { instructions } «else { instructions } »
if ( condition) { instructions } else if ( condition) { instructions } ... «else { instructions } »
switch ( variable) { case case1: instructions } { case case2: instructions } ...
Фортран
IF ( condition) THEN instructions ELSE instructions ENDIF
IF ( condition) THEN instructions ELSEIF ( condition) THEN instructions ...
ELSE instructions ENDIF
SELECT CASE( variable) CASE ( case1) instructions ...
CASE DEFAULT instructions END SELECT
Forth
condition IF instructions « ELSE instructions» THEN
condition IF instructions ELSE condition IF instructions THEN THEN
value CASE case OF instructions ENDOF case OF instructions ENDOF default instructionsENDCASE
condition IF valueIfTrue ELSE valueIfFalse THEN
OCaml
if condition then begin instructions end «else begin instructions end »
if condition then begin instructions end else if condition then begin instructions end ... «else begin instructions end »
match value with pattern1 -> expression | pattern2 -> expression ... «| _ -> expression»[b]
if condition then valueIfTrue else valueIfFalse
F#
if condition then Tab ↹ instructions «else Tab ↹ instructions»
if condition then Tab ↹ instructions elif condition then Tab ↹ instructions ... «else Tab ↹ instructions»
Standard ML
if condition then «( »instructions «) »else «( » instructions «) »
if condition then «( »instructions «) »else if condition then «( » instructions «) » ...else «( » instructions «) »
case value of pattern1 => expression | pattern2 => expression ... «| _ => expression»[b]
Haskell (GHC)
if condition then expression else expression orwhen condition (do instructions) orunless notcondition (do instructions)
result | condition = expression | condition = expression | otherwise = expression
case value of { pattern1 -> expression; pattern2 -> expression; ... «_ -> expression»} [b]
Bash shell
if condition-command; then
expression
«else
expression»
fi
if condition-command; then
expression
elif condition-command; then
expression
«else
expression»
fi
case "$variable" in
"$condition1" )
command...
"$condition2" )
command...
esac
CoffeeScript
if condition then expression «else expression»
if condition then expression else if condition then expression «else expression»
switch expression when condition then expression else expression
All conditions are expressions
if condition expression «else expression»
if condition expression else if condition expression «else expression»
expression if condition
unless condition expression else unless condition expression «else expression»
switch expression when condition expression «else expression»
unless condition expression «else expression»
expression unless condition
КОБОЛ
IF condition «THEN » expression «ELSE expression». [d]
EVALUATE expression «ALSO expression...» WHEN case-or-condition «ALSO case-or-condition...» expression ... «WHEN OTHER expression» END-EVALUATE
if
else if
select case
conditional expression
^a Једна инструкција може бити написана на истој линији након главног дела. Вишеструка упутства су груписана у блоку који почиње новим редом (увлачење је потребно). Условна исказна синтакса не прати ово правило.
^b Ово је образац подударања и сличан је изабраном случају али не и исти. Обично се користи да деконструише алгебарски тип структуре .
^c У језицима сличним Паскалу, запета није део изјаве. То је сепаратор између изјава, не терминатор.
^d END-IF може да се користи уместо периода на крају.
while
do while
for i = first to last
foreach
Ада [ 1]
while condition loop statements end loop
loop statements exit when not condition end loop
for index in «reverse » [first .. last | discrete_type] loop statements end loop
for item of «reverse » iterator loop statements end loop (for [all | some ] [in | of ] [first .. last | discrete_type | iterator] => predicate) [b]
ALGOL 68
«for index» «from first» «by increment» «to last» «while condition» do statements od
for key «to upb list » do «typename val =list [key ];» statements od
«while condition»
do statements od
«while statements; condition»
do statements od
«for index» «from first» «by increment» «to last» do statements od
C (C99)
while ( condition) { instructions }
do { instructions } while ( condition)
for ( «type» i = first; i <= last; ++ i) { instructions }
Н/Д
Objective-C
for ( type item in set) { instructions }
C++ (STL)
«std:: »for_each( start, end, function)
(C++11 ) for ( type item : set) { instructions }
C#
foreach ( type item in set) { instructions }
Јава
for ( type item : set) { instructions }
JavaScript
for (var i = first; i <= last; i++) { instructions }
for (var index in set) { instructions } or for each (var item in set) { instructions } (JS 1.6+, deprecated[ 10] ) orfor (var item of set) { instructions } (EcmaScript 6 proposal, supported in Firefox[ 11] )
PHP
foreach (range( first, last) as $i) { instructions } or for ($i = first; $i <= last; $i++) { instructions }
foreach ( set as item) { instructions } or foreach ( set as key => item) { instructions }
Windows PowerShell
for ($i = first; $i -le last; $i++) { instructions }
foreach ( item in set) { instructions using item }
D
foreach (i; first ... last ) { instructions }
foreach («type» item; set) { instructions }
Гоу
for condition { instructions }
for i := first; i <= last; i++ { instructions }
for key, item := range set { instructions }
Swift
while condition { instructions }
repeat { instructions } while condition (2.x) do { instructions } while condition (1.x)
for i = first ... last { instructions } or for i = first ..< last+1 { instructions } or for var i = first; i <= last; i++ { instructions }
for item in set { instructions }
Перл
while ( condition) { instructions } or until ( notcondition) { instructions }
do { instructions } while ( condition) or do { instructions } until ( notcondition)
for «each » «$i » ( first .. last) { instructions } or for ($i = first; $i <= last; $i++) { instructions }
for «each » «$item» ( set) { instructions }
Перл 6
while condition { instructions } or until notcondition { instructions }
repeat { instructions } while condition or repeat { instructions } until notcondition
for first.. last -> $i { instructions } or loop ($i = first; $i <= last; $i++) { instructions }
for set« -> $item» { instructions }
Руби
while condition instructions end or until notcondition instructions end
begin instructions end while condition or begin instructions end until notcondition
for i in first.. last instructions end or for i in first... last+1 instructions end or first.upto( last) { |i| instructions }
for item in set instructions end or set.each { | item| instructions }
Bash shell
while condition ;do instructions done or until notcondition ;do instructions done
Н/Д
for (( i = first; i <= last; ++ i)) ; do
instructions
done
for item in set ;do instructions done
Скала
while ( condition) { instructions }
do { instructions } while ( condition)
for ( i <- first to last «by 1 ») { instructions } or first to last «by 1 » foreach ( i => { instructions })
for ( item <- set) { instructions } or set foreach ( item => { instructions })
Smalltalk
conditionBlock whileTrue: loopBlock
loopBlock doWhile: conditionBlock
first to: last do: loopBlock
collection do: loopBlock
Common Lisp
(loop while conditiondo instructions) or (do () ( notcondition) instructions)
(loop do instructionswhile condition)
(loop for i from first to last «by 1» do instructions) or (dotimes (i N) instructions) or (do ((i first (1+ i))) ((>= i last)) instructions)
(loop for item in setdo instructions) or (dolist ( item set) instructions) or (mapc function list) or (map ' type function sequence)
Шема
(do () ( notcondition) instructions) or (let loop () (if condition (begin instructions (loop))))
(let loop () ( instructions (if condition (loop))))
(do ((i first (+ i 1))) ((>= i last)) instructions) or (let loop ((i first)) (if (< i last) (begin instructions (loop (+ i 1)))))
(for-each (lambda ( item) instructions) list)
ISLISP
(while condition instructions)
(tagbody loop instructions (if condition (go loop))
(for ((i first (+ i 1))) ((>= i last)) instructions)
(mapc (lambda ( item) instructions) list)
Паскал
while condition do begin instructions end
repeat instructions until notcondition;
for i := first «step 1 » to last do begin instructions end; [a]
for item in set do ...
Visual Basic
Do While condition instructions Loop or Do Until notcondition instructions Loop
Do instructions Loop While condition or Do instructions Loop Until notcondition
For i = first To last «Step 1 » instructions Next i
For Each item In set instructions Next item
Visual Basic .NET
For i «As type» = first To last «Step 1 » instructions Next i [a]
For Each item As type In set instructions Next item
Xojo
While condition instructions Wend
Do Until notcondition instructions Loop or Do instructions Loop Until notcondition
Пајтон
while condition : Tab ↹ instructions «else: Tab ↹ instructions»
Н/Д
for i in range( first, last+1): Tab ↹ instructions «else: Tab ↹ instructions» (Python 3.x)
for i in xrange( first, last+1): Tab ↹ instructions «else: Tab ↹ instructions» (Python 2.x)
for item in set: Tab ↹ instructions «else: Tab ↹ instructions»
S-Lang
while ( condition) { instructions } «then optional-block»
do { instructions } while ( condition) «then optional-block»
for (i = first; i <= last; i++) { instructions } «then optional-block»
foreach item( set) «using ( what) » { instructions } «then optional-block»
Фортран
DO WHILE ( condition) instructions ENDDO
DO instructions IF ( condition) EXIT ENDDO
DO I = first, last instructions ENDDO
Н/Д
Forth
BEGIN « instructions » condition WHILE instructions REPEAT
BEGIN instructions condition UNTIL
limit start DO instructions LOOP
Н/Д
OCaml
while condition do instructions done
Н/Д
for i = first to last do instructions done
Array.iter (fun item -> instructions) array List.iter (fun item -> instructions) list
F#
while condition do Tab ↹ instructions
Н/Д
for i = first to last do Tab ↹ instructions
for item in set do Tab ↹ instructions or Seq.iter (fun item -> instructions) set
Standard ML
while condition do ( instructions )
Н/Д
Array.app (fn item => instructions) array app (fn item => instructions) list
Haskell (GHC)
Н/Д
Control.Monad.forM_ [ first.. last] (\i -> do instructions)
Control.Monad.forM_ list (\item -> do instructions)
Ајфел
from setup until condition loop instructions end
CoffeeScript
while condition expression
Н/Д
for i in [first..last] expression
for item in set expression
expression while condition
while condition then expression
until condition expression
expression until condition
for i in [first..last] then expression
for item in set then expression
until condition then expression
expression for i in [first..last]
expression for item in set
COBOL
PERFORM procedure-1 «THROUGH procedure-2» ««WITH » TEST BEFORE » UNTIL condition[c]
PERFORM procedure-1 «THROUGH procedure-2» «WITH » TEST AFTER UNTIL condition[c]
PERFORM procedure-1 «THROUGH procedure-2» VARYING i FROM first BY increment UNTIL i > last[d]
Н/Д
PERFORM ««WITH » TEST BEFORE » UNTIL condition expression END-PERFORM
PERFORM «WITH » TEST AFTER UNTIL condition expression END-PERFORM
PERFORM VARYING i FROM first BY increment UNTIL i > last expression END-PERFORM [d]
^a "step n" се користи за промену интервал петље. Ako је "step " изостављен, онда интервал петља је 1.
^b Овај спроводи универзални квантификатор ("за све" или "∀") као и егзистенцијални квантификатор ("постоји" или "∃").
^c THRU се може користити уместо THROUGH .
^d «IS » GREATER «THAN » се може користити уместо > .
домашај
опис
тврдња
Ada [ 1]
raise exception_name «with string_expression»
begin statements exception when exception_list1 => statements;when exception_list2 => statements; ...«when others => statements;» end [b]
pragma Assert ( «Check => » boolean_expression ««Message => » string_expression») [function | procedure | entry] with Pre => boolean_expressionPost => boolean_expression any_type with Type_Invariant => boolean_expression
C (C99)
longjmp ( state, exception);
switch (setjmp ( state)) { case 0: instructions break; case exception: instructions ... }
assert( condition);
C++
throw exception;
try { instructions } catch «( exception) » { instructions } ...
C#
try { instructions } catch «( exception) » { instructions } ... «finally { instructions } »
Debug.Assert( condition);
Java
try { instructions } catch ( exception) { instructions } ... «finally { instructions } »
assert condition;
JavaScript
try { instructions } catch ( exception) { instructions } «finally { instructions } »
?
D
try { instructions } catch ( exception) { instructions } ... «finally { instructions } »
assert( condition);
PHP
try { instructions } catch ( exception) { instructions } «finally { instructions } »
assert( condition);
S-Lang
try { instructions } catch «exception» { instructions } ... «finally { instructions } »
?
Windows PowerShell
trap «[ exception] » { instructions } ... instructions or try { instructions } catch «[ exception] » { instructions } ... «finally { instructions } »
[Debug]::Assert( condition)
Objective-C
@throw exception;
@try { instructions } @catch ( exception) { instructions } ... «@finally { instructions } »
NSAssert( condition, description);
Swift
throw exception (2.x)
do { try expression ... instructions } catch exception { instructions } ... (2.x)
assert( condition«, description»)
Перл
die exception;
eval { instructions }; if ($@) { instructions }
?
Перл 6
try { instructions CATCH { when exception { instructions } ...}}
?
Руби
raise exception
begin instructions rescue exception instructions ... «else instructions» «ensure instructions» end
Smalltalk
exception raise
instructionBlock on: exception do: handlerBlock
assert: conditionBlock
Common Lisp
(error "exception") or (error (make-condition typearguments))
(handler-case (progn instructions) ( exception instructions) ...) or (handler-bind ( condition (lambda instructions «invoke-restart restart args»)) ...) [a]
(assert condition) or (assert condition«( place) «error»») or (check-type var type)
Шема (R6 RS)
(raise exception)
(guard (con ( condition instructions) ...) instructions)
?
ISLISP
(error "error-string" objects) or (signal-condition condition continuable)
(with-handler handler form*)
?
Паскал
raise Exception.Create()
try Except on E: exception do begin instructions end; end;
?
Visual Basic
Err.Raise ERRORNUMBER
With New Try: On Error Resume Next OneInstruction .Catch: On Error GoTo 0: Select Case .Number Case ERRORNUMBER instructions End Select: End With
'*** Try class ***
Private mstrDescription As String
Private mlngNumber As Long
Public Sub Catch ()
mstrDescription = Err . Description
mlngNumber = Err . Number
End Sub
Public Property Get Number () As Long
Number = mlngNumber
End Property
Public Property Get Description () As String
Description = mstrDescription
End Property
[ 12]
Debug.Assert condition
Visual Basic .NET
Throw exception
Try instructions Catch «exception» «When condition» instructions ... «Finally instructions» End Try
Debug.Assert( condition)
Xojo
Raise exception
Try instructions Catch «exception»instructions ... «Finally instructions» End Try
Н/Д
Пајтон
raise exception
try: Tab ↹ instructions except «exception»: Tab ↹ instructions ... «else: Tab ↹ instructions» «finally: Tab ↹ instructions»
assert condition
Фортран
Н/Д
Forth
code THROW
xt CATCH ( code or 0 )
Н/Д
OCaml
raise exception
try expression with pattern -> expression ...
assert condition
F#
try expression with pattern -> expression ...
or try expression finally expression
Standard ML
raise exception «arg»
expression handle pattern => expression ...
Haskell (GHC)
throw exception or throwError expression
catch tryExpression catchExpression or catchError tryExpression catchExpression
assert condition expression
КОБОЛ
RAISE «EXCEPTION » exception
USE «AFTER » EXCEPTION OBJECT class-name. or
USE «AFTER » EO class-name. or
USE «AFTER » EXCEPTION CONDITION exception-name «FILE file-name». or
USE «AFTER » EC exception-name «FILE file-name».
Н/Д
^a Common Lisp омогућује with-simple-restart
, restart-case
и restart-bind
за дефинисање рестартовања за коришћење са invoke-restart
. Услови неизузетака се могу изазвати применама да покажу кориснику да се мени рестартује пре него што одпочне.
^b Безусловни изузеци су пропагирани у најдубља динамички прихватна извршења. Изузеци не пропагирају преко задатака (осим ако су ови задаци тренутно синхронизовани у састанцима).
Остали извештаји управљања протоком
излаз блока (пауза)
наставак
Дугме
грана (гото )
враћа вредност из генератора
Ада [ 1]
exit «loop_name» «when condition»
Н/Д
label:
goto label
Н/Д
ALGOL 68
value exit ; ...
do statements; skip exit ; label: statements od
label: ...
go to label; ...
goto label; ...
label; ...
yield (value )
(Callback )[ 13]
C (C99)
break;
continue;
label:
goto label;
Н/Д
Objective-C
C++ (STL)
D
C#
yield return value;
Java
break «label»;
continue «label»;
Н/Д
JavaScript
yield value«;»
PHP
break «levels»;
continue «levels»;
goto label;
yield «key =>» value;
Перл
last «label»;
next «label»;
Перл 6
Гоу
break «label»
continue «label»
goto label
Swift
break «label»
continue «label»
Н/Д
Bash shell
break «levels»
continue «levels»
Н/Д
Н/Д
Н/Д
Common Lisp
(return) or (return-from block) or (loop-finish)
(tagbody tag... tag ...)
(go tag)
Шема
ISLISP
(return-from block)
(tagbody tag... tag ...)
(go tag)
Паскал (ISO)
Н/Д
label: [a]
goto label;
Н/Д
Паскал (FPC)
break;
continue;
Visual Basic
Exit block
Н/Д
label:
GoTo label
Visual Basic .NET
Continue block
Xojo
Пајтон
break
continue
Н/Д
yield value
RPG IV
LEAVE;
ITER;
S-Lang
break;
continue;
Фортран
EXIT
CYCLE
label [b]
GOTO label
Н/Д
Руби
break
next
Windows PowerShell
break «label»
continue
OCaml
Н/Д
F#
Standard ML
Haskell (GHC)
КОБОЛ
EXIT PERFORM or EXIT PARAGRAPH or EXIT SECTION or EXIT.
EXIT PERFORM CYCLE
label «SECTION ».
GO TO label
Н/Д
Ya
break «from where»; f.e.
break for switch;
continue «to where»; f.e.
continue for switch;
: label
goto : label;
Н/Д
^a Паскал има декларацију блокова.
^b дугме мора бити број између 1 и 99999.
позивање функцијом
основа/празнина функције
враћање вредности функције
потреба главни потпрограм
Ада [ 1]
foo «(parameters)»
procedure foo «(parameters)» is begin statements end foo
function foo «(parameters)» return type is begin statements end foo
Н/Д
ALGOL 68
foo «(parameters)»;
proc foo = «(parameters)» void : ( instructions );
proc foo = «(parameters)» rettype : ( instructions ...; retvalue );
Н/Д
C (C99)
foo( «parameters»)
void foo( «parameters») { instructions }
type foo( «parameters») { instructions ... return value; }
«global declarations» int main( «int argc, char *argv[] ») { instructions }
Objective-C
C++ (STL)
C#
static void Main( «string[] args ») { instructions } or static int Main( «string[] args ») { instructions }
Java
public static void main(String[] args) { instructions } or public static void main(String... args) { instructions }
D
int main( «char[][] args ») { instructions} or int main( «string[] args ») { instructions} or void main( «char[][] args ») { instructions} or void main( «string[] args ») { instructions}
JavaScript
function foo( «parameters») { instructions } or var foo = function ( «parameters») { instructions } or var foo = new Function ( «" parameter", ... ," last parameter" » " instructions");
function foo( «parameters») { instructions ... return value; }
Н/Д
Гоу
func foo( «parameters») { instructions }
func foo( «parameters») type { instructions ... return value }
func main() { instructions }
Swift
func foo( «parameters») { instructions }
func foo( «parameters») -> type { instructions ... return value }
Н/Д
Common Lisp
(foo «parameters»)
(defun foo ( «parameters») instructions) or (setf (symbol-function ' symbol) lambda)
(defun foo ( «parameters») ... value)
Н/Д
Шема
(define (foo parameters) instructions) or (define foo (lambda ( parameters) instructions))
(define (foo parameters) instructions... return_value) or (define foo (lambda ( parameters) instructions... return_value))
ISLISP
(defun foo ( «parameters») instructions)
(defun foo ( «parameters») ... value)
Паскал
foo «( parameters) »
procedure foo «( parameters) »; «forward; »[a]
«label label declarations»
«const constant declarations»
«type type declarations»
«var variable declarations»
«local function declarations»begin instructions end;
function foo «( parameters) »: type; «forward; »[a]
«label label declarations»
«const constant declarations»
«type type declarations»
«var variable declarations»
«local function declarations»begin instructions; foo := value end;
program name;
«label label declarations»
«const constant declarations»
«type type declarations»
«var variable declarations»
«function declarations»begin instructions end.
Visual Basic
Foo( «parameters»)
Sub Foo( «parameters») instructions End Sub
Function Foo( «parameters») As type instructions Foo = value End Function
Sub Main() instructions End Sub
Visual Basic .NET
Function Foo( «parameters») As type instructionsReturn value End Function
Sub Main( «ByVal CmdArgs() As String ») instructions End Sub or Function Main( «ByVal CmdArgs() As String ») As Integer instructionsEnd Function
Xojo
Пајтон
foo( «parameters»)
def foo( «parameters»): Tab ↹ instructions
def foo( «parameters»): Tab ↹ instructions Tab ↹ return value
Н/Д
S-Lang
foo( «parameters» «;qualifiers»)
define foo ( «parameters») { instructions }
define foo ( «parameters») { instructions ... return value; }
public define slsh_main () { instructions }
Фортран
foo ( «arguments») CALL sub_foo ( «arguments») [c]
SUBROUTINE sub_foo ( «arguments») instructions END SUBROUTINE [c]
type FUNCTION foo ( «arguments») instructions ...
foo = value END FUNCTION[c]
PROGRAM main instructions END PROGRAM
Forth
«parameters» FOO
: FOO « stack effect comment: ( before -- ) » instructions ;
: FOO « stack effect comment: ( before -- after ) » instructions ;
Н/Д
PHP
foo( «parameters»)
function foo( «parameters») { instructions }
function foo( «parameters») { instructions ... return value; }
Н/Д
Перл
foo( «parameters») or &foo «( parameters) »
sub foo { «my ( parameters) = @_; » instructions }
sub foo { «my ( parameters) = @_; » instructions... «return » value; }
Перл 6
foo( «parameters») or &foo «( parameters) »
«multi »sub foo( parameters) { instructions }
«our «type» »«multi »sub foo( parameters) { instructions... «return » value; }
Руби
foo «( parameters) »
def foo «( parameters) » instructions end
def foo «( parameters) » instructions «return » value end
Скала
def foo «( parameters) »«: Unit = » { instructions }
def foo «( parameters) »«: type» = { instructions ... «return » value }
def main(args: Array[String]) { instructions }
Windows PowerShell
foo «parameters»
function foo { instructions }; or function foo { « param(parameters )» instructions }
function foo «( parameters) » { instructions … return value }; orfunction foo { «param( parameters) » instructions … return value }
Н/Д
Bash shell
foo «parameters»
function foo {
instructions
}
or
foo () {
instructions
}
function foo {
instructions
return «exit_code»
}
or
foo () {
instructions
return «exit_code»
}
parameters
$ n ($1 , $2 , $3 , ...)
$@ (all parameters)
$# (the number of parameters)
$0 (this function name)
OCaml
foo parameters
let «rec » foo parameters = instructions
let «rec » foo parameters = instructions... return_value
F#
[<EntryPoint>] let main args = instructions
Standard ML
fun foo parameters = ( instructions )
fun foo parameters = ( instructions... return_value )
Haskell
foo parameters = do Tab ↹ instructions
foo parameters = return_value or foo parameters = do Tab ↹ instructionsTab ↹ return value
«main :: IO () » main = do instructions
Ајфел
foo ( «parameters»)
foo ( «parameters») require preconditions do instructions ensure postconditions end
foo ( «parameters») : typerequire preconditions do instructions Result := value ensure postconditions end
[b]
CoffeeScript
foo()
foo = ->
foo = -> value
Н/Д
foo parameters
foo = () ->
foo = ( parameters ) -> value
COBOL
CALL " foo" «USING parameters» «exception-handling» «END-CALL »[d]
«IDENTIFICATION DIVISION. »
PROGRAM-ID. foo.
«other divisions...»
PROCEDURE DIVISION «USING parameters».
instructions.
«IDENTIFICATION DIVISION. »
PROGRAM-ID /FUNCTION-ID. foo.
«other divisions...»
DATA DIVISION.
«other sections...»
LINKAGE SECTION.
«parameter definitions...»
variable-to-return definition
«other sections...»
PROCEDURE DIVISION «USING parameters» RETURNING variable-to-return.
instructions.
Н/Д
«FUNCTION » foo«(«parameters»)»
Н/Д
^a Паскал захтева "forward; " за forward декларацијаs .
^b Ајфелова омогућава спецификацију корена класе апликацију и функције.
^c У Фортрану, функција/потпрограм параметара се називају аргументима (док PARAMETER је кључна реч језика); CALL је кључна реч за потпрограм.
^d Користи уместо "foo" , низа променљиву која се може користити уместо садржаја исте вредности.
Где је string означен као децимални број:
string за integer
string за long integer
string за floating point
integer за string
floating point за string
Ада [ 1]
Integer'Value ( string_expression)
Long_Integer'Value ( string_expression)
Float'Value ( string_expression)
Integer'Image ( integer_expression)
Float'Image ( float_expression)
ALGOL 68 with general, and then specific formats
With prior declarations and association of: string buf := "12345678.9012e34 "; file proxy; associate(proxy, buf);
get(proxy, ivar);
get(proxy, livar);
get(proxy, rvar);
put(proxy, ival);
put(proxy, rval);
getf(proxy, ($g$, ivar));
orv
getf(proxy, ($dddd$, ivar));
getf(proxy, ($g$, livar));
or
getf(proxy, ($8d$, livar));
getf(proxy, ($g$, rvar));
or
getf(proxy, ($8d.4dE2d$, rvar));
putf(proxy, ($g$, ival));
or
putf(proxy, ($4d$, ival));
putf(proxy, ($g(width, places, exp)$, rval));
or
putf(proxy, ($8d.4dE2d$, rval));
etc.
C (C99)
integer = atoi ( string);
long = atol ( string);
float = atof ( string);
sprintf ( string, "%i", integer);
sprintf ( string, "%f", float);
Objective-C
integer = [ string intValue];
long = [ string longLongValue];
float = [ string doubleValue];
string = [NSString stringWithFormat :@"%i", integer];
string = [NSString stringWithFormat :@"%f", float];
C++ (STL)
«std:: »istringstream( string) >> number;
«std:: »ostringstream o; o << number; string = o.str();
C++11
integer = « std::»stoi( string);
long = « std::»stol( string);
float = « std::»stof( string);
double = « std::»stod( string);
string = « std::»to_string( number);
C#
integer = int.Parse ( string);
long = long.Parse ( string);
float = float.Parse ( string); or double = double.Parse ( string);
string = number .ToString();
D
integer = std.conv.to!int ( string)
long = std.conv.to!long ( string)
float = std.conv.to!float ( string) or double = std.conv.to!double ( string)
string = std.conv.to!string ( number)
Java
integer = Integer.parseInt ( string);
long = Long.parseLong ( string);
float = Float.parseFloat ( string); or double = Double.parseDouble ( string);
string = Integer.toString ( integer); or string = String.valueOf ( integer);
string = Float.toString ( float); or string = Double.toString ( double);
JavaScript[a]
integer = parseInt( string);
float = parseFloat( string); or float = new Number ( string) or float = Number ( string) or float = + string
string = number.toString (); or string = new String ( number); or string = String ( number); or string = number+"";
Гоу
integer, error = strconv.Atoi( string) or integer, error = strconv.ParseInt ( string, 10, 0)
long, error = strconv.ParseInt ( string, 10, 64)
float, error = strconv.ParseFloat ( string, 64)
string = strconv.Itoa( integer) or string = strconv.FormatInt ( integer, 10) or string = fmt.Sprint( integer)
string = strconv.FormatFloat ( float) or string = fmt.Sprint ( float)
Common Lisp
(setf integer (parse-integer string))
(setf float (read-from-string string))
(setf string (princ-to-string number))
Шема
(define number (string->number string))
(define string (number->string number))
ISLISP
(setf integer (convert string <integer>))
(setf float (convert string <float>))
(setf string (convert number <string>))
Паскал
integer := StrToInt( string);
float := StrToFloat( string);
string := IntToStr( integer);
string := FloatToStr( float);
Visual Basic
integer = CInt( string)
long = CLng( string)
float = CSng( string) or double = CDbl( string)
string = CStr( number)
Visual Basic .NET
Xojo
integer = Val( string)
long = Val( string)
double = Val( string) or double = CDbl( string)
string = CStr( number) or string = Str( number)
Пајтон
integer = int( string)
long = long( string)
float = float( string)
string = str( number)
S-Lang
integer = atoi ( string);
long = atol ( string);
float = atof ( string);
string = string( number);
Фортран
READ( string, format) number
WRITE( string, format) number
PHP
integer = intval( string); or integer = (int) string;
float = floatval( string); or float = (float) string;
string = " number"; or string = strval( number); or string = (string) number;
Перл[b]
number = 0 + string;
string = " number";
Перл 6
number = + string;
string = ~ number;
Руби
integer = string.to_i or integer = Integer( string)
float = string.to_f or float = Float( string)
string = number.to_s
Скала
integer = string.toInt
long = string.toLong
float = string.toFloat or double = string.toDouble
string = number.toString
Smalltalk
integer := Integer readFrom: string
float := Float readFrom: string
string := number asString
Windows PowerShell
integer = [int] string
long = [long] string
float = [float] string
string = [string] number; or string = " number"; or string = ( number).ToString()
OCaml
let integer = int_ of_string string
let float = float_ of_string string
let string = string_ of_int integer
let string = string_ of_float float
F#
let integer = int string
let integer = int64 string
let float = float string
let string = string number
Standard ML
val integer = Int .fromString string
val float = Real .fromString string
val string = Int .toString integer
val string = Real .toString float
Haskell (GHC)
number = read string
string = show number
КОБОЛ
MOVE «FUNCTION » NUMVAL( string) [c] TO number
MOVE number TO numeric-edited
^a JavaScript користи само децимални број, тако да су неки техникалије.[ 7]
^b Перл нема одвојене врсте. Стрингови и бројеви су заменљиви.
^c NUMVAL-C
или NUMVAL-F
се могу заменити уместо NUMVAL
.
читан
писан у
stdin
stdout
stderr
Ada [ 1]
Get ( x)
Put ( x)
Put (Standard_Error, x)
ALGOL 68
readf(( $format$, x)); or getf(stand in, ( $format$, x));
printf (( $format$, x)); or putf(stand out, ( $format$, x));
putf(stand error, ( $format$, x)); [a]
C (C99)
scanf ( format, & x); or fscanf (stdin, format, & x); [b]
printf ( format, x); or fprintf (stdout, format, x); [c]
fprintf (stderr, format, x ); [d]
Objective-C
data = [[NSFileHandle fileHandleWithStandardInput] readDataToEndOfFile];
[[NSFileHandle fileHandleWithStandardOutput] writeData: data];
[[NSFileHandle fileHandleWithStandardError] writeData: data];
C++
«std:: »cin >> x; or «std:: »getline( «std:: »cin, str);
«std:: »cout << x;
«std:: »cerr << x; or «std:: »clog << x;
C#
x = Console.Read(); or x = Console.ReadLine();
Console.Write( «format, »x); or Console.WriteLine( «format, »x);
Console.Error .Write( «format, »x); or Console.Error .WriteLine( «format, »x);
D
x = std.stdio.readln()
std.stdio.write( x) or std.stdio.writeln( x) or std.stdio.writef( format, x) or std.stdio.writefln( format, x)
stderr.write( x) or stderr.writeln( x) or std.stdio .writef(stderr, format, x) or std.stdio .writefln(stderr, format, x)
Java
x = System.in.read(); or x = new Scanner(System.in) .nextInt(); or x = new Scanner(System.in) .nextLine();
System.out.print( x); or System.out.printf ( format, x); or System.out.println( x);
System.err.print( x); or System.err.printf ( format, x); or System.err.println( x);
Гоу
fmt.Scan(& x) or fmt.Scanf ( format, & x) or x = bufio.NewReader(os.Stdin) .ReadString('\n')
fmt.Println( x) or fmt.Printf ( format, x)
fmt.Fprintln(os.Stderr, x) or fmt.Fprintf (os.Stderr, format, x)
Swift
x = readLine() (2.x)
print( x) (2.x) println( x) (1.x)
JavaScriptWeb Browser implementation
document.write( x)
JavaScriptActive Server Pages
Response.Write( x)
JavaScriptWindows Script Host
x = WScript.StdIn.Read( chars) or x = WScript.StdIn.ReadLine()
WScript.Echo( x) or WScript.StdOut.Write( x) or WScript.StdOut.WriteLine( x)
WScript.StdErr.Write( x) or WScript.StdErr.WriteLine( x)
Common Lisp
(setf x (read-line))
(princ x) or (format t format x)
(princ x *error-output*) or (format *error-output* format x)
Шема (R6 RS)
(define x (read-line))
(display x) or (format #t format x)
(display x (current-error-port)) or (format (current-error-port) format x)
ISLISP
(setf x (read-line))
(format (standard-output) format x)
(format (error-output) format x)
Паскал
read( x); or readln( x);
write( x); or writeln( x);
Н/Д
Visual Basic
Input « prompt, » x
Print x or ? x
Visual Basic .NET
x = Console.Read() or x = Console.ReadLine()
Console.Write( «format, »x) or Console.WriteLine( «format, »x)
Console.Error .Write( «format, »x) or Console.Error .WriteLine( «format, »x)
Xojo
x = StandardInputStream.Read() or x = StandardInputStreame.ReadLine()
StandardOutputStream.Write( x) or StandardOutputStream.WriteLine( x)
StdErr.Write( x) or StdErr.WriteLine( x)
Пајтон 2.x
x = raw_input( «prompt»)
print x or sys.stdout.write( x)
print >> sys.stderr, x or sys.stderr.write( x)
Пајтон 3.x
x = input( «prompt»)
print( x«, end="" »)
print( x«, end="" », file=sys.stderr)
S-Lang
fgets (& x, stdin)
fputs ( x, stdout)
fputs ( x, stderr)
Фортран
READ(*, format) variable names or READ(INPUT_UNIT, format) variable names[e]
WRITE(*, format) expressions or WRITE(OUTPUT_UNIT, format) expressions[e]
WRITE(ERROR_UNIT, format) expressions[e]
Forth
buffer length ACCEPT ( # chars read ) KEY ( char )
buffer length TYPE char EMIT
Н/Д
PHP
$x = fgets (STDIN); or $x = fscanf (STDIN, format);
print x; or echo x; or printf ( format, x);
fprintf (STDERR, format, x);
Перл
$x = <>; or $x = <STDIN>;
print x; or printf format, x;
print STDERR x; or printf STDERR format, x;
Перл 6
$x = $*IN.get;
x.print or x.say
x.note or $*ERR.print( x) or $*ERR.say( x)
Руби
x = gets
puts x or printf ( format, x)
$stderr.puts( x) or $stderr.printf ( format, x)
Windows PowerShell
$x = Read-Host «« -Prompt » text»; or $x = [Console]::Read(); or $x = [Console]::ReadLine()
x; or Write-Output x; or echo x
Write-Error x
OCaml
let x = read_int () or let str = read_line () or Scanf.scanf format (fun x ... -> ...)
print_int x or print_endline str or Printf.printf format x ...
prerr_int x or prerr_endline str or Printf.eprintf format x ...
F#
let x = System.Console .ReadLine()
printf format x ... or printfn format x ...
eprintf format x ... or eprintfn format x ...
Standard ML
val str = TextIO.inputLIne TextIO.stdIn
print str
TextIO.output (TextIO.stdErr, str)
Haskell (GHC)
x <- readLn or str <- getLine
print x or putStrLn str
hPrint stderr x or hPutStrLn stderr str
КОБОЛ
ACCEPT x
DISPLAY x
^a Algol 68 додатно као "неформатирани" транспут рутина: read , write , get и put .
^b gets (x) и fgets (x, length, stdin) прочитајте неформатирани текст из стдин. Коришћење добијања се не препоручује.
^c puts (x) и fputs (x, stdout) напише неформатирани текст на стдоут.
^d fputs(x, stderr) пише неформатирани текст на стдоут.
^e INPUT_UNIT , OUTPUT_UNIT , ERROR_UNIT су дефинисани у ISO_FORTRAN_ENV модулу.[ 14]
Аргумент вредности
Аргумент рачуна
Назив програма / име скрипте
Ada [ 1]
Argument ( n)
Argument_Count
Command_Name
C (C99)
argv[ n]
argc
first argument
Objective-C
C++
C#
args[ n]
args.Length
Assembly.GetEntryAssembly() .Location;
Java
args.length
D
first argument
JavaScript Windows Script Host implementation
WScript.Arguments( n)
WScript.Arguments.length
WScript.ScriptName or WScript.ScriptFullName
Гоу
os.Args[ n]
len(os.Args)
first argument
Swift
Process.arguments[ n] or Process.unsafeArgv[ n]
Process.arguments.count or Process.argc
first argument
Common Lisp
?
?
?
Шеме (R6 RS)
(list-ref (command-line) n)
(length (command-line))
first argument
ISLISP
Н/Д
Н/Д
Н/Д
Паскал
ParamStr( n)
ParamCount
first argument
Visual Basic
Command [a]
Н/Д
App.Path
Visual Basic .NET
CmdArgs( n)
CmdArgs.Length
[Assembly].GetEntryAssembly().Location
Xojo
System.CommandLine
(string parsing)
Application.ExecutableFile.Name
Пајтон
sys.argv[ n]
len(sys.argv)
first argument
S-Lang
__argv[ n]
__argc
first argument
Фортран
DO i = 1, argc CALL GET_COMMAND_ARGUMENT ( i, argv(i)) ENDDO
argc = COMMAND_ARGUMENT_COUNT ()
CALL GET_COMMAND_ARGUMENT ( 0, progname)
PHP
$argv[ n]
$argc
first argument
Bash shell
$ n ($1 , $2 , $3 , ...)$@ (all arguments)
$#
$0
Перл
$ARGV[ n]
scalar(@ARGV)
$0
Перл 6
@*ARGS[ n]
@*ARGS.elems
$PROGRAM_NAME
Руби
ARGV[ n]
ARGV.size
$0
Windows PowerShell
$args[ n]
$args.Length
$MyInvocation.MyCommand .Name
OCaml
Sys.argv.( n)
Array.length Sys.argv
first argument
F#
args.[ n]
args.Length
Assembly.GetEntryAssembly() .Location
Standard ML
List.nth (CommandLine .arguments (), n)
length (CommandLine .arguments ())
CommandLine.name ()
Haskell (GHC)
do { args <- System . getArgs ; return length args !! n
}
do { args <- System . getArgs ; return length args
}
System.getProgName
КОБОЛ
[b]
Н/Д
^a Командна линија у Visual Basic није одвојена. Сплит функција Split( string)
је потребна за их раздваја.
^b стандардни КОБОЛ не укључује било који начин за приступање командне линије аргумената, али заједнички компајлер-екстензије за приступ њима укључује дефинисање параметара за главни програм или помоћу ACCEPT
исказ.
Извршење команди
Shell команда
Извршење програма
Замена тренутног програма са новим извршним програмом
Ada [ 1]
Not part of the language standard. Commonly done by compiler provided packages or by interfacing to C or Posix.[ 15]
C
system (" command");
execl ( path, args); or execv ( path, arglist);
C++
Objective-C
[NSTask launchedTaskWithLaunchPath:(NSString *) path arguments:(NSArray *) arguments];
C#
System.Diagnostics .Process.Start( path, argstring);
F#
Гоу
exec.Run( path, argv, envv, dir, exec.DevNull, exec.DevNull, exec.DevNull)
os.Exec( path, argv, envv)
Visual Basic
Interaction.Shell( command «, WindowStyle» «, isWaitOnReturn»)
Visual Basic .NET
Microsoft.VisualBasic .Interaction.Shell( command «, WindowStyle» «, isWaitOnReturn»)
System.Diagnostics .Process.Start( path, argstring)
Xojo
Shell.Execute( command «, Parameters»)
FolderItem.Launch( parameters, activate)
Н/Д
D
std.process.system(" command");
std.process.execv( path, arglist);
Java
Runtime.exec( command); or new ProcessBuilder( command).start();
JavaScript Windows Script Host implementation
WScript.CreateObject ("WScript.Shell").Run( command «, WindowStyle» «, isWaitOnReturn»);
WshShell.Exec(command)
Common Lisp
(shell command)
Шема
(system command)
ISLISP
Н/Д
Н/Д
Н/Д
Паскал
system( command);
OCaml
Sys.command command, Unix.open_process_full command env (stdout, stdin, stderr),...
Unix.create_process prog args new_stdin new_stdout new_stderr, ...
Unix.execv prog args or Unix.execve prog args env
Standard ML
OS.Process.system command
Unix.execute ( path, args)
Posix.Process.exec ( path, args)
Haskell (GHC)
System.system command
System.Process .runProcess path args ...
Posix.Process .executeFile path True args ...
Перл
system( command) or $output = ` command` or $output = qx( command)
exec( path, args)
Руби
system( command) or output = ` command`
exec( path, args)
PHP
system( command) or $output = ` command` or exec( command) or passthru( command)
Пајтон
os.system( command) or subprocess.Popen( command)
subprocess.call( ["program", "arg1", "arg2", …])
os.execv( path, args)
S-Lang
system( command)
Фортран
CALL SYSTEM ( command, status) or status = SYSTEM ( command) [a]
Windows PowerShell
[Diagnostics.Process]::Start( command)
«Invoke-Item »program arg1 arg2 …
Bash shell
output=` command` or
output=$( command)
program arg1 arg2 …
^a Компајлер завистан екстензије.[ 16]
Референце