---
title: "init(forConditional:trueExpression:falseExpression:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsexpression/init(forconditional:trueexpression:falseexpression:)"
---

# init(forConditional:trueExpression:falseExpression:)

Creates an expression that returns a result, depending on the value of predicate.

## Declaration

```swift
init(forConditional predicate: NSPredicate, trueExpression: NSExpression, falseExpression: NSExpression)
```

## Parameters

- `predicate`: The predicate for determining whether the element belongs in the result collection.
- `trueExpression`: The expression for evaluation when the predicate evaluates to true.
- `falseExpression`: The expression for evaluation when the predicate evaluates to false.
