---
title: "init(_:_:_:_:otherwise:)"
framework: appintents
role: symbol
role_heading: Initializer
path: "appintents/parametersummarywhencondition/init(_:_:_:_:otherwise:)-tyz2"
---

# init(_:_:_:_:otherwise:)

Creates a When condition comparing a union value parameter to a specific case.

## Declaration

```swift
init<ValueType, Parameter>(_ keyPath: KeyPath<Intent, Parameter>, _ comparisonOperator: EquatableComparisonOperator, _ value: ValueType.ValueType.Cases, @ParameterSummaryBuilder<Intent> _ when: () -> WhenCondition, @ParameterSummaryBuilder<Intent> otherwise: () -> Otherwise) where ValueType == Parameter.Value, Parameter : AnyIntentValue, ValueType.ValueType : AppUnionValue
```

## Parameters

- `keyPath`: Key path to the union value parameter
- `comparisonOperator`: The comparison operator (.equalTo or .notEqualTo)
- `value`: The union value case to compare against
- `when`: The summary to use when the condition is true
- `otherwise`: The summary to use when the condition is false
