This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Getting Started / Tour of Mathematica  /

Mathematica as a Programming Language

Mathematica is an unprecedentedly flexible and intuitive programming language.

Mathematica includes advanced programming methods from modern computer science—and adds a host of new ideas of its own.

Mathematica incorporates a range of programming paradigms—so you can write every program in its most natural way.

Procedural Programming

List-based Programming

Many operations are automatically threaded over lists.

This flattens out sublists.

This partitions into sublists of length 2.

Functional Programming

The is a "pure function" with # being the slot in which the argument is inserted.

Rule-Based Programming

The _ stands for a single expression; __ stands for any sequence of expressions.

Object-Oriented Programming

Here are three definitions to be associated with the object h.

This uses the definitions made for h.

String-Based Programming

Mixed Programming Paradigms

Many of Mathematica's most powerful functions mix different programming paradigms.

Mathematica gives you the flexibility to write programs in many different styles.

A dozen definitions of the factorial function

After you have finished with definitions for f, you must clear them.