AssignWhen (AssignWhen v0.2.0)

View Source

Allows the use of 'when' clauses on assignment statements as an alternative to using 'if', avoiding the need for boilerplate 'else' clauses which return the original variables when the condition is 'false'. Eg:

x = 1 when x == nil

can replace

x = if x == nil, do: 1, else: x

Summary

Functions

Allow when clauses on assignment statements as an alternative to if clauses.

Functions

arg when condition

(macro)

Allow when clauses on assignment statements as an alternative to if clauses.