[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'math' (#rtl)

# ifthen

Return one of two values, depending on a boolean condition

## Declaration

Source position: line 0

`function ifthen(`
`val: Boolean;`
`const iftrue: Integer;`
`const iffalse: Integer = 0`
`):Integer; overload; function ifthen(`
`val: Boolean;`
`const iftrue: Int64;`
`const iffalse: Int64 = 0`
`):Int64; overload; function ifthen(`
`val: Boolean;`
`const iftrue: double;`
`const iffalse: double = 0.0`
`):double; overload;`

## Description

ifthen returns iftrue if val is True, and iffalse if val is False.

This function can be used in expressions.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.