# When

fun <R> When(cond: T, result: Expression<R>): ValueCaseWhen<T, R>

Adds a WHEN clause that compares the case value against a literal condition.

#### Return

A ValueCaseWhen instance for method chaining

#### Parameters

cond

The literal value to compare against

result

The expression to return if the condition matches

#### Type Parameters

R

The return type of the result expression

fun <R> When(cond: Expression<T>, result: Expression<R>): ValueCaseWhen<T, R>

Adds a WHEN clause that compares the case value against an expression condition.

#### Return

A ValueCaseWhen instance for method chaining

#### Parameters

cond

The expression to compare against

result

The expression to return if the condition matches

#### Type Parameters

R

The return type of the result expression

fun <R> When(cond: Expression<T>, result: R, resultType: IColumnType<R & Any>? = null): ValueCaseWhen<T, R>

Adds a WHEN clause that compares the case value against an expression condition with a literal result.

#### Return

A ValueCaseWhen instance for method chaining

#### Parameters

cond

The expression to compare against

result

The literal value to return if the condition matches

resultType

Optional column type for the result value

#### Type Parameters

R

The return type of the result value

fun <R> When(cond: T, result: R, resultType: IColumnType<R & Any>? = null): ValueCaseWhen<T, R>

Adds a WHEN clause that compares the case value against a literal condition with a literal result.

#### Return

A ValueCaseWhen instance for method chaining

#### Parameters

cond

The literal value to compare against

result

The literal value to return if the condition matches

resultType

Optional column type for the result value

#### Type Parameters

R

The return type of the result value