GAP

Influenced by:
Paradigm:
Typing discipline:
File extensions:
.gap
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

Examples:

Hello, World!:

Example for versions GAP 4.4.12

To run as a script use gap -q < filename.gap

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

Factorial:

Example for versions GAP 4.4.12

This example uses standard Factorial function.

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