This article compares a large number of programming languages by tabulating their data types, their expression, statement, and declaration syntax, and some common operating-system interfaces.

Conventions of this article

Generally, var, , or is how variable names or other non-literal values to be interpreted by the reader are represented. The rest is literal code. Guillemets ( and ) enclose optional sections. indicates a necessary (whitespace) indentation.

Comparison of programming languages (basic instructions)

The tables are not sorted lexicographically ascending by programming language name by default, and that some languages have entries in some tables but not others.

Comparison of programming languages (basic instructions)

Type identifiers

Integers

The standard constants and can be used to determine how many s and s can be usefully prefixed to and . The actual sizes of , , and are available as the constants , , and etc. Commonly used for characters. The ALGOL 68, C and C++ languages do not specify the exact width of the integer types , , , and (C99, C++11) , so they are implementation-dependent. In C and C++ , , and types are required to be at least 16, 32, and 64 bits wide, respectively, but can be more. The type is required to be at least as wide as and at most as wide as , and is typically the width of the word size on the processor of the machine (i.e. on a 32-bit machine it is often 32 bits wide; on 64-bit machines it is sometimes 64 bits wide). C99 and C++11 also define the exact-width types in the stdint.h header. See C syntax#Integral types for more information. In addition the types and are defined in relation to the address size to hold unsigned and signed integers sufficiently large to handle array indices and the difference between pointers. Perl 5 does not have distinct types. Integers, floating point numbers, strings, etc. are all considered "scalars". PHP has two arbitrary-precision libraries. The BCMath library just uses strings as datatype. The GMP library uses an internal "resource" type. The value of is provided by the intrinsic function. ALGOL 68G's runtime option can set precision for s to the required "number" significant digits. The standard constants and can be used to determine actual precision. COBOL allows the specification of a required precision and will automatically select an available type capable of representing the specified precision. "", for example, would require a signed variable of four decimal digits precision. If specified as a binary field, this would select a 16-bit signed type on most platforms. Smalltalk automatically chooses an appropriate representation for integral numbers. Typically, two representations are present, one for integers fitting the native word size minus any tag bit () and one supporting arbitrary sized integers (). Arithmetic operations support polymorphic arguments and return the result in the most appropriate compact representation. Ada range types are checked for boundary violations at run-time (as well as at compile-time for static expressions). Run-time boundary violations raise a "constraint error" exception. Ranges are not restricted to powers of two. Commonly predefined Integer subtypes are: Positive (range 1 .. Integer'Last) and Natural (range 0 .. Integer'Last). (8 bits), (16 bits) and (64 bits) are also commonly predefined, but not required by the Ada standard. Runtime checks can be disabled if performance is more important than integrity checks. Ada modulo types implement modulo arithmetic in all operations, i.e. no range violations are possible. Modulos are not restricted to powers of two. Commonly used for characters like Java's char. in PHP has the same width as type in C has on that system. Erlang is dynamically typed. The type identifiers are usually used to specify types of record fields and the argument and return types of functions. When it exceeds one word.

Comparison of programming languages (basic instructions)

Floating point

The standard constants and can be used to determine how many s and s can be usefully prefixed to and . The actual sizes of , , and are available as the constants , and etc. With the constants , and available for each type's machine epsilon. declarations of single precision often are not honored The value of is provided by the intrinsic function. ALGOL 68G's runtime option can set precision for s to the required "number" significant digits. The standard constants and can be used to determine actual precision. These IEEE floating-point types will be introduced in the next COBOL standard. Same size as on many implementations. Swift supports 80-bit extended precision floating point type, equivalent to in C languages.

Complex numbers

The value of is provided by the intrinsic function. Generic type which can be instantiated with any base floating point type.