ArticleslgStudy

science

Comparison of programming languages (basic instructions)

Comparison of programming languages (basic instructions) is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Comparison of programming languages (basic instructions) rather than just read about it. In short: 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, var, or var is how variable names or other non-literal values to be interpreted by the reader are represented.

Key takeaways

  • Comparison of programming languages (basic instructions) belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Comparison of programming languages (basic instructions) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Comparison of programming languages (basic instructions) from memory before moving on to harder problems.

Reference excerpt

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, var, or var 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. Tab ↹ indicates a necessary (whitespace) indentation. 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.

Type identifiers

Integers

^a The standard constants int shorts and int lengths can be used to determine how many shorts and longs can be usefully prefixed to short int and long int. The actual sizes of short int, int, and long int are available as the constants short max int, max int, and long max int etc. ^b Commonly used for characters. ^c The ALGOL 68, C and C++ languages do not specify the exact width of the integer types short, int, long, and (C99, C++11) long long, so they are implementation-dependent. In C and C++ short, long, and long long types are required to be at least 16, 32, and 64 bits wide, respectively, but can be more. The int type is required to be at least as wide as short and at most as wide as long, 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 [u]intN_t exact-width types in the stdint.h header. See C syntax#Integral types for more information. In addition the types size_t and ptrdiff_t 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. ^d Perl 5 does not have distinct types. Integers, floating point numbers, strings, etc. are all considered "scalars". ^e PHP has two arbitrary-precision libraries. The BCMath library just uses strings as datatype. The GMP library uses an internal "resource" type. ^f The value of n is provided by the SELECTED_INT_KIND intrinsic function. ^g ALGOL 68G's runtime option --precision "number" can set precision for long long ints to the required "number" significant digits. The standard constants long long int width and long long max int can be used to determine actual precision. ^h COBOL allows the specification of a required precision and will automatically select an available type capable of representing the specified precision. "PIC S9999", 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. ^i Smalltalk automatically chooses an appropriate representation for integral numbers. Typically, two representations are present, one for integers fitting the native word size minus any tag bit (SmallInteger) and one supporting arbitrary sized integers (LargeInteger). Arithmetic operations support polymorphic arguments and return the result in the most appropriate compact representation. ^j 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). Short_Short_Integer (8 bits), Short_Integer (16 bits) and Long_Integer (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. ^k Ada modulo types implement modulo arithmetic in all operations, i.e. no range violations are possible. Modulos are not restricted to powers of two. ^l Commonly used for characters like Java's char. ^m int in PHP has the same width as long type in C has on that system.[c] ^n Erlang is dynamically typed. The type identifiers are usually used to specify types of record fields and the argument and return types of functions. ^o When it exceeds one word.

Floating point

^a The standard constants real shorts and real lengths can be used to determine how many shorts and longs can be usefully prefixed to short real and long real. The actual sizes of short real, real, and long real are available as the constants short max real, max real and long max real etc. With the constants short small real, small real and long small real available for each type's machine epsilon. ^b declarations of single precision often are not honored ^c The value of n is provided by the SELECTED_REAL_KIND intrinsic function. ^d ALGOL 68G's runtime option --precision "number" can set precision for long long reals to the required "number" significant digits. The standard constants long long real width and long long max real can be used to determine actual precision. ^e These IEEE floating-point types will be introduced in the next COBOL standard. ^f Same size as double on many implementations. ^g Swift supports 80-bit extended precision floating point type, equivalent to long double in C languages.

Complex numbers

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

Other variable types

^a specifically, strings of arbitrary length and automatically managed. ^b This language represents a boolean as an integer where false is represented as a value of zero and true by a non-zero value. ^c All values evaluate to either true or false. Everything in TrueClass evaluates to true and everything in FalseClass evaluates to false. ^dThis language does not have a separate character type. Characters are represented as strings of length 1. ^e Enumerations in this language are algebraic types with only nullary constructors ^f The value of n is provided by the SELECTED_INT_KIND intrinsic function.

Derived types

Array

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Comparison of programming languages (basic instructions)

Start with the simplest possible case. Write down what Comparison of programming languages (basic instructions) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Comparison of programming languages (basic instructions) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Comparison of programming languages (basic instructions) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Comparison of programming languages (basic instructions)

In research
Comparison of programming languages (basic instructions) appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Comparison of programming languages (basic instructions) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Comparison of programming languages (basic instructions) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Programming constructs, Programming language comparisons, so understanding it makes those chapters shorter.
In everyday life
Look for Comparison of programming languages (basic instructions) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Comparison of programming languages (basic instructions)” →

How to study Comparison of programming languages (basic instructions) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Comparison of programming languages (basic instructions) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Comparison of programming languages (basic instructions) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Comparison of programming languages (basic instructions) in simple terms?

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, var, or var is how variable names or other non-literal values t…

Why does Comparison of programming languages (basic instructions) matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Comparison of programming languages (basic instructions)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Comparison of programming languages (basic instructions).

Tags

  • Programming constructs
  • Programming language comparisons

Keep exploring