safelyOr

fun <T, R> (T) -> R.safelyOr(input: T, default: R): R

Executes the receiver function safely, returning a default value if an exception occurs.

Return

The result of the function or the default value if an exception occurred.

Parameters

T

The input type for the function.

R

The output type of the function.

input

The input value for the function.

default

The default value to return in case of an exception.