www.delorie.com/gnu/docs/guile/guile_291.html   search  
Buy GNU books!

Guile Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

26.1 Evaluating a Sequence of Expressions

begin is used for grouping several expression together so that they syntactically are treated as if they were one expression. This is particularly important when syntactic expressions are used which only allow one expression, but the programmer wants to use more than one expression in that place. As an example, consider the conditional expression below:

(if (> x 0)
    (begin (display "greater") (newline)))

If the two calls to display and newline were not embedded in a begin-statement, the call to newline would get misinterpreted as the else-branch of the if-expression.

syntax: begin expr1 expr2 ...
The expression(s) are evaluated in left-to-right order and the value of the last expression is returned as the value of the begin-expression. This expression type is used when the expressions before the last one are evaluated for their side effects.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003