expressed in lambda terms as: and [:x | x + 1] value: 3 can be evaluated as Or in lambda terms as: The resulting block object can form a closure: it can access the variables of its enclosing lexical scopes at any time. Blocks are first-class objects. Blocks can be executed by sending them the value message (compound variations exist in order to provide parameters to the block e.g. 'value:value:' and 'valueWithArguments:'). The literal representation of blocks was an innovation which on the one hand allowed certain code to be significantly more readable; it allowed algorithms involving iteration to be coded in a clear and concise way. Code that would typically be written with loops in some languages can be written concisely in Smalltalk using blocks, sometimes in a single line. But more importantly blocks allow control structure to be expressed using messages and polymorphism, since blocks defer computation and polymorphism can be used to select alternatives. So if-then-else in Smalltalk is written and implemented as expr ifTrue: [statements to evaluate if expr] ifFalse: [statements to evaluate if not expr] True methods for evaluation False methods for evaluation positiveAmounts := allAmounts select: [:anAmount | anAmount isPositive] Note that this is related to functional programming, wherein patterns of computation (here selection) are abstracted into higher-order functions. For example, the message select: on a Collection is equivalent to the higher-order function filter on an appropriate functor. Control structures Control structures do not have special syntax in Smalltalk. They are instead implemented as messages sent to objects. For example, conditional execution is implemented by sending the message ifTrue: to a Boolean object, passing as an argument the block of code to be executed if and only if the Boolean receiver is true. The two subclasses of Boolean both implement ifTrue:, where the implementation in subclass True always evaluates the block and the implementation in subclass False never evaluates the block. The following code demonstrates this: result := a > b ifTrue:[ 'greater' ] ifFalse:[ 'less or equal' ] Blocks are also used to implement user-defined control structures, enumerators, visitors, exception handling, pluggable behavior and many other patterns. For example: | aString vowels | aString := 'This is a string'. vowels := aString select: [:aCharacter | aCharacter isVowel]. In the last line, the string is sent the message select: with an argument that is a code block literal. The code block literal will be