<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSScriptCommandDescription/isOptionalArgument(withName:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSScriptCommandDescription(im)isOptionalArgumentWithName:"
  },
  "title" : "isOptionalArgument(withName:)"
}
-->

# isOptionalArgument(withName:)

Returns a Boolean value that indicates whether the command argument identified by the specified argument key is an optional argument.

```
func isOptionalArgument(withName argumentName: String) -> Bool
```

## Parameters

`argumentName`

Argument name (used as a key) that identifies the command argument to examine.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the specified argument exists and is optional; otherwise, <doc://com.apple.documentation/documentation/Swift/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)