query
On this page

optionals

lib.optionals

Docs pulled from | This Revision | 35 minutes ago


Return a list or an empty list, depending on a boolean value.

Inputs

cond

Condition

elems

List to return if condition is true

Type

optionals :: bool -> [a] -> [a]

Examples

lib.lists.optionals usage example

optionals true [ 2 3 ]
=> [ 2 3 ]
optionals false [ 2 3 ]
=> [ ]
(lib.lists.optionals)

Noogle also knows

Aliases