Berserk Docs
Scalar FunctionsConditional Functions

coalesce

Returns the first non-empty value (not null and not empty string).

Syntax

coalesce(value)

Parameters

Prop

Type

Returns: any

Examples

Example 1

print coalesce(null, 793)
print_0 (long)
793

Example 2

print coalesce('', 'Valhalla')
print_0 (string)
Valhalla

Example 3

print coalesce(dynamic(null), dynamic(42), 5)
print_0 (long)
42

On this page