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
  • What You Can Do with Expressions
  • Limitations

Was this helpful?

Edit on GitHub
  1. Guides

Expressions

PreviousWorking with DataNextBuilding Agents

Last updated 1 month ago

Was this helpful?

Expressions in Midio allow you to write small snippets of logic directly inside function inputs. They can be used anywhere a function input is editable and are a powerful way to perform computations or dynamically construct values inline.

What You Can Do with Expressions

Expressions support many of the constructs you'd expect from a general-purpose language:

  • Unary and binary operators: Use operators like +, -, *, /, !, and more to perform arithmetic and logical operations.

  • Ternary operator: Use the condition ? valueIfTrue : valueIfFalse form to choose between values based on a condition.

  • Literals: You can use basic data literals including numbers (42), strings ("hello"), booleans (true, false), objects ({a: 1}), and lists ([1, 2, 3]).

  • Inputs: Add inputs to your expression by simply writing an identifier name (e.g., inputValue). This adds an additional input property underneath the input you placed the expression in.

  • Indexing and calls: Use [index] to access list or object properties and () to call functions. Note: Functions must currently be passed in as inputs to be called in expressions.

  • String interpolation: Embed expressions inside strings using ${...} syntax. For example: "Hello, ${name}!".

Limitations

Use : Local variables can be retrieved by prefixing their name with @, e.g. @myVariable.

Expressions currently cannot be used directly inside object literals—this will be added in a future update. See the guide for more information about how you can work around this limitation for now.

Local Variables
working with data