Class Progn

Introduction

This class allows you to evaluate multiple expressions, returning only the last one. This enables you to evaluate multiple expressions within a let, for example. Even though Progn is a class, it's meant to be used more like a single function.

Syntax


progn.do(expr).returning(rexpr) => result
progn.do(expr).then(expr).returning(rexpr) => result
progn.do(expr).then(expr).then(expr).returning(rexpr) => result
(etc.)

where:

Discussion

Each expr will be evaluated in order, beginning with the one passed to do() followed by each then(). Finally, rexpr will be evaluated and returned. This allows you to evaluate multiple expressions in a single statement, but return a meaningful value. The type of result returned will be one of the following: int, a, decimal, @Var, or object -- depending on the type of rexpr.