HiveLang

Variables

Learn how to declare, assign, and use variables in HiveLang.

Declaring Variables

Use the set keyword to create and assign variables.

example.hive
bot "Calculator"
  on input
    set price = 100
    set tax = 0.2
    set total = price * (1 + tax)
    say f"Total: {total}"
  end
end

Variable Types

HiveLang supports several data types:

  • Numbers — Integers and decimals (e.g., 42, 3.14)
  • Strings — Text in quotes (e.g., "hello")
  • Booleanstrue or false
  • Lists — Collections (e.g., [1, 2, 3])

F-Strings (Interpolation)

Use f-strings to embed variables inside strings. Prefix the string with f and wrap variables in curly braces.

interpolation.hive
set name = "Alice"
set greeting = f"Hello, {name}!"
say greeting  // Output: Hello, Alice!

Storing Tool Results

Use the as keyword to store the result of a tool call.

tool-result.hive
call integrations.google.search(query: "AI news") as results
say f"Found: {results}"

Was this page helpful?

Confused? Ask HiveMind.

Our autonomous AI assistant can explain any concept, write code snippets, or guide you through the SDK.