Midio docs
  • Getting Started
    • Welcome
    • Quick Start Guide
  • Your First Midio App
  • Guides
    • HTTP
      • Making HTTP Requests
      • Responding to HTTP Requests
      • How to reach your own endpoints
      • CORS
      • Server-Sent Events (SSE)
    • Branching
    • Loops
    • Map, filter, reduce
    • Working with Data
    • Expressions
    • Building Agents
      • Streaming Agent API (experimental)
    • Debugging
    • Secrets and Environment variables
    • Convert JSON to data nodes
    • Writing tests
    • Cleaning up your flows
  • Package Manager
  • Integrating with third party services
  • Troubleshooting
  • Tutorials
    • Connecting LLMs to MCP-servers using the MCP-client package
    • Making Your Own MCP Server in Midio
    • A Fast Path to Functional RAG Agents
    • How to build a streaming agent using Server-Sent Events (SSE)
  • Reference
    • The Midio Editor
      • The Node Editor
      • User Traces
      • Traces (execution)
      • Processes
      • Log
      • Services
      • Problems
      • Function Signature
      • Data
      • Settings
    • The Midio Language
      • Nodes and execution
      • Functions and Events
        • Anonymous functions
      • Modules
      • Contexts
      • Data type
      • Local variables
      • Portals
      • Waypoint node
      • Partial function application
  • The Midio Engine
  • Built in Nodes
    • Core (std)
    • HTTP
    • LLM
Powered by GitBook
On this page
  • Map outputs automatically to local variables
  • Mutability
  • What does local mean?

Was this helpful?

Edit on GitHub
  1. Reference
  2. The Midio Language

Local variables

PreviousData typeNextPortals

Last updated 15 days ago

Was this helpful?

Variables lets us assign data to a named key, which can then later be retrieved or changed.

  • You can use the Set Variable node to assign a value to a variable name.

  • And get the value of a variable using the Get Variable node.

Map outputs automatically to local variables

Any function output can be automatically mapped to a local variable (meaning it automatically sets a local variable to the value of that output after it has been called). You can do this by simply clicking the output property on the function instance. You can then also edit the name if you want to set a different variable.

Mutability

Note that all places that sets a variable must declare it "mutable" if there is more than one place that sets.

What does local mean?

Variables being local means changing a variable in one module or function doesn't affect a variable with the same name in a different module or function. This means you don't have to worry about the same variable already being in use in a different part of your application; you only have to look in the current function/module.

Local variables can be either mutable or immutable (the default). This is a mechanism that helps prevent bugs where two nodes make changes to the same variable without you explicitly declaring that this is OK. You can make a variable mutable by clicking the "mut" toggle button on a setter or getter node, or from a dropdown on the function output property if you are using the .

Note that a variables value does not persist between .

processes
automatic mapping