Here is a list of features common to most programming languages, but implemented in a different way by each language. Some of the differences are rather trivial, but some make a large difference in a language's potential.

Developer Comments

A developer comment is text inserted into the code that is not meant to be executed. EGs:
REM A comment in DOS and BASIC
' A comment in Visual Basic
<!-- A comment in HTML and XML -->
C A comment in FORTRAN
(* A comment in PASCAL *)
NOTE A comment in COBOL
COMMENT A comment in ALGOL-60
# A comment in tcl, PERL, and PHP
// A single line comment in PL/I and the C family 
/*
    A multi-line comment in
    PL/I and the C family
*/

Statement Layout

This includes the general syntax of most of the lines of code in the program. This is usually very language specific.

  • A important (but easy to note) difference between programming languages is what sort of restrictions are placed on the usage of white space, i.e. spaces, tabs, and blank lines.
    • A formatted language has set rules about the usage of white space.
    • A free-formatted language can use the white space more freely, often to the effect of making the page visually easier to read.
  • Another important but easy to note difference is how the programming language deals with case, i.e. code in upper and lower case. EG: in some languages Hello is not the same as hello.
  • Some languages will also break up the code into areas, modular chunks/blocks, or even modules (separate files).
    • Curly braces. The most common syntax. Used by languages such as C, C++, D, Java, JavaScript, AWK, Perl, PHP, C#, and Pico.
      if (x <= 3) {
          run(y);
      }
      
    • Keywords. VB uses this.
      If (x <= 3) Then
          run(y)
      End If
      
    • Indentation. Python uses this.
      if x <= 3:
          run(y)
      
    • Special characters. EG: LISP uses a lot of parentheses.
      (defun helloworld ()
        (format t "hello, world")
      )

Data Types

All programs deal with data. Mouse movements, sound, pictures, and video are all nothing but 0s and 1s on computers. This data is often presented in basic data types. This include various kinds of numeric, Boolean, array, and text data types.

See also my article on Data Types.

Identifiers

All the variables and modular chunks of code have to be distinguished by an identifier, i.e. they should be named. If the programming language is OOP, then instance of objects have to be named too.

  • Identifiers cannot be a reserved word in that programming language.
  • All identified items usually had a scope over which they applied. EG: Was the scope just for those few lines?, that module?, that entire document?, etc.
  • Identifiers can be loosely or strongly defined. If loosely defined, then the identifier is assumed the first time it is encountered.  If strongly defined, then it is declared at some point in the program, and at some point its hold on memory space must be released.

Operators

Operators are the symbols that denote basic functions performed. Operators have zero or more expressions (parameter or arguments) that they work upon.

Math. Here are some common ones:

Operator Symbol Input
9 and 4
Note
Addition + 13  
Subtraction - 5  
Division / 2.25  
Multiplication * 36  
Modulus
aka
Modulo
%
mod
1 The remainder after division.
Integer
Division
\ 2 The integer after division.

Assignment. These usually assigns values to identifiers. This syntax is usually like variable = 1 .

Boolean (a.k.a. Logical). These usually perform compare two expressions (each of which is either true, false, or null) and returns TRUE and FALSE values. The NOT operator only needs one expression. Here are some common ones:

NOT  
True False
False True
Null Null
AND True False Null
True True False Null
False False False False
Null Null False False
OR True False Null
True True True True
False True False Null
Null True Null Null
XOR True False Null
True False True Null
False True False Null
Null Null Null Null
EQV True False Null
True True False Null
False False True Null
Null Null Null Null
IMP True False Null
True True False Null
False True True True
Null True Null Null

Bitwise. These perform bit manipulations, i.e. they take the binary representation of numbers and perform Boolean math upon them. EG:
9 & 4 is just like

9 = 1001
4 = 0100 &
    -----
    0000   = 0

Here are some common ones:

Operator Symbol Input
9 and 4
Bitwise AND &
AND
0
Bitwise OR |
OR
13
Bitwise XOR ^
XOR
13

Comparison. A variation on Boolean operators, these usually compare two expressions and return a true or false value. Here are some common ones.

Operator Symbol Input
9 and 4
Equal to =
==
FALSE
Greater than > TRUE
Less than < FALSE
Greater than or equal to >= TRUE
Less than or equal to <= FALSE
Not equal to <> TRUE
Not equal to != TRUE
Not less than !< TRUE
Not greater than !> FALSE

String. There usually manipulate strings of characters. String concatenation is the most common and often has syntax like this: 'hel' & 'lo' or 'hel' + 'lo'.

Unary. These perform a function on a single expression. Here are some common ones:

Operator Symbol Input
9
Numeric value is positive. + 9
Numeric value is negative. - -9
Returns the ones complement of the number.
NOT the significant binary number for the
"negative" value.
~ -10

Operators usually usually have an order of precedence. Operators of higher precedence are performed before those of lower precedence. When operators have the same precedence, they are evaluated left to right. Parentheses are often used to clarify precedence. EG:

x = 2 + 3 * 5
'x is 17 because multiplication has precedence
x = 2 + (3 * 5)
'x is 17
x = (2 + 3) * 5
'x is 30

Flow Control

Flow Control (aka Control Flow; control of flow) is how a programming deals with options.

  • Conditional Branching. Lets a program choose between different options. EG:
    IF condition THEN do this
    
    IF condition1 THEN do this ELSE IF condition2 THEN do this ELSE do this
    
    SELECT CASE expression
    CASE expression value list 1
       do this
    CASE expression value list 2
       do this
    CASE ELSE
       do this
    END SELECT
    
  • Unconditional Branching. Sends a program somewhere. Structured programming does not use unconditional branching, whereas unstructured programming does. This should be avoided when possible. EG:
    GO TO this part of the program
  • Looping and Iteration. Repeats a portion of code and keep track of the number of repetitions. EG:
    DO this code UNTIL this condition is met LOOP
    
    FOR counter values x TO y do this NEXT increment the counter
    

Functions

A function is a chunk of code that does work, and is usually invoked by calling upon by its identifier. Zero or more arguments (parameters) are usually passed along to the function when it is called upon. Some functions may return a value back to the location where the function was invoked. Functions are sort of like more complicated variations of operators. Functions include perform calculations related to areas such as science, finances, and dates.
  • Intrinsic Functions, a.k.a. Library or built-in functions. These are functions available as part of the language or as third-party add-ins to the language.
  • User-Defined Functions. These are custom functions made by the developer.

Note that in an OOP (Object Oriented Programming) language, objects can be intrinsic and user-defined as well!

Functions are either deterministic or non-deterministic. A deterministic function always returns the same results when fed the same arguments. A non-deterministic function may return different results for the same set of arguments.

Functions are sometimes grouped according to the numbers of arguments they accept:

No. of Arguments Group
0 nullary or nilladic
1 unary
2 binary
3 ternary
  • No argument functions are called nullary or niladic.
  • One argument functions are called unary.
  • Two

Functions and subroutines both do work, but whereas a function usually returns a value with its identifier, a subroutine does not. EG:

x = ThisFunctionReturnsAValue(ArgumentPassed)
ThisSubroutineDoesNotReturnAValue(ArgumentPassed)

Input/Output

The different ways that data goes into and out of the program, including the following:

  • Reading and writing files
  • Scanning and printing documents
  • Accepting input from users and machinery
  • Video display
  • Keyboards, joystick, and mice.

Program Halts

Various methods of stopping, pausing, or otherwise interrupting a program. This is also used in debugging programs. Some programming languages have no stops until the program ends.



GeorgeHernandez.comSome rights reserved