## 2.3 Accumulators

loops can also be used in expression position to accumulate values. The value of the implicit accumulator is returned when the loop terminates.

`<<collect E>>`

  adds element E at the end of the list being collected. Can be used together will `append`

`<<append L>>`

  appends L at the end of the list being collected. Can be used together with `collect`

`<<count B>>`

  if `B` is true, adds 1 to the accumulated counter. Can be used together with `sum`

`<<sum E>>`

  adds `E` to the accumulated counter. Can be used together with `count`

`<<maximize E>>`

  replaces the current accumulated value if `E` is greater

`<<minimize E>>`

  replaces the current accumulated value if `E` is smaller