# takeif

    .takeif value:{Dynamic} condition:{Lambda} -> Any

Content copied to clipboard

Keeps value if condition is true, otherwise returns none.

Note: this function is usually inlined:

    .takeif {5} {x: .x::iseven} <!-- None -->

Content copied to clipboard

This function is particularly useful when chained, for example:

    .sum {2} {3}::takeif {x: .iseven {.x}}::otherwise {0} <!-- 0 -->

Content copied to clipboard

#### Return

value if the result of condition is true, none otherwise

#### Parameters

value

value to check

condition

condition to check, which accepts one argument (value) and returns a boolean

#### Chaining

This function is designed to be chained with other function calls:

    Dynamic::takeif condition:{Lambda} -> Any

Content copied to clipboard

#### Wiki page

none