Language

Complete language reference for Behl syntax and semantics.

Behl combines the simplicity and flexibility of Lua’s semantics with the familiar syntax of C-style languages.

Key Differences from C

  • Dynamic typing - Variables don’t have fixed types
  • Tables - Primary data structure (arrays + dictionaries)
  • 0-indexed - Arrays start at index 0
  • First-class functions - Functions are values
  • Garbage collection - Automatic memory management
  • Multiple returns - Functions can return multiple values

Key Differences from Lua

  • C-like syntax - Uses ; terminators and {} blocks
  • 0-indexed tables - Unlike Lua’s 1-indexed tables
  • C-style comments - // and /* */ instead of -- and --[[]]
  • Logical operators - && || ! instead of and or not
  • Power operator - ** instead of ^
  • Bitwise operators - & | ^ ~ instead of functions

See Differences from Lua for complete details.

Quick Example

// C-like syntax with dynamic typing
function fibonacci(n) {
    if (n <= 1) {
        return n
    }
    return fibonacci(n - 1) + fibonacci(n - 2)
}

let result = fibonacci(10)
print(result) // 55

Table of contents


Copyright © 2025 behl Project. Distributed under MIT License.

This site uses Just the Docs, a documentation theme for Jekyll.