<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/ParameterSummaryWhenCondition/init(_:_:_:_:otherwise:)-2qooo",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "App Intents",
      "AppIntents"
    ],
    "preciseIdentifier" : "s:10AppIntents29ParameterSummaryWhenConditionV____9otherwiseACyxq_q0_Gs7KeyPathCyxqd_0_G_AA27EquatableComparisonOperatorO9ValueTypeAA07_IntentM0P_5CasesAA0a5UnionM0PQYd__q_yXEq0_yXEtcs23ExpressibleByNilLiteralRd__0M0Qyd_0_Rsd__AA03AnyoM0Rd_0_AaokMRpd__r0_lufc"
  },
  "title" : "init(_:_:_:_:otherwise:)"
}
-->

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

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

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

## Parameters

`keyPath`

Key path to the optional 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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)