Influenced by:
Typing discipline:
File extensions:
Versions and implementations (Collapse all | Expand all):
Programming language

GAP — programming language of GAP (Groups, Algorithms, Programming) computer algebra system.

Elements of syntax:

Inline comments #
Case-sensitivity yes
Variable assignment varname := value
Physical (shallow) equality =
Physical (shallow) inequality <>
Comparison < > <= >=
If - then if condition then trueBlock fi;
Loop forever while true do loopBody od;
For each value in a numeric range, 1 increment for i in [first..last] do loopBody od;

GAP 4 loading banner
GAP 4 loading banner


Hello, World!:

Example for versions GAP 4.4.12

To run as a script use gap -q <

Print("Hello, Wolrd!\n");


Example for versions GAP 4.4.12

This example uses standard Factorial function.

for n in [0..16] do
    Print(n, "! = ", Factorial(n), "\n");