<!--
{
  "availability" : [
    "macCatalyst: 14.0.0 -",
    "macOS: 10.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Automator",
  "identifier" : "/documentation/Automator/AMWorkflow/valueForVariable(withName:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Automator"
    ],
    "preciseIdentifier" : "c:objc(cs)AMWorkflow(im)valueForVariableWithName:"
  },
  "title" : "valueForVariable(withName:)"
}
-->

# valueForVariable(withName:)

Returns the value of the workflow variable with the specified name.

```
func valueForVariable(withName variableName: String) -> Any?
```

## Parameters

`variableName`

The variable name.

## Return Value

The value for the variable. Returns `nil` if no variable is found with the specified name.

## Discussion

---

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)