← Previous | Next

The vast majority of code you will write in Objective Caml will be expressions. An expression is usually a mathematical formula or something close to one. The simplest expression is a constant, such as:

1

This is not a very useful expression. A slightly more useful example would be using Objective Caml as a pocket calculator, with expressions like:

(2 + 4) * 3

Objective Caml runs expressions by computing their value: this is known as evaluation. The above expression would result in the integer value 18. As we discover more elements of the language, the rules for evaluation will become more complex, but the fundamental principle remains almost intact: an Objective Caml program is an expression or series of expressions, running the program means evaluating those expressions.

← Previous | Next

0 Responses to “Expressions”


  1. No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



1208 feed subscribers
(readers who polled a feed this week)