Language Specification

Variables

Variables are declared using the let keyword and are dynamically typed.

let name = "FlowLang-Script"
let version = 1
let pi = 3.14

Data Types

  • Integer: Whole numbers (42, -10)
  • String: Text enclosed in double quotes ("hello")
  • List: Returned by built-in functions like range()
  • Dictionary: Returned by JSON parsing in HTTP responses

Operators

Arithmetic Operators

OperatorDescriptionExample
+Addition5 + 3 returns 8
-Subtraction10 - 4 returns 6
*Multiplication3 * 4 returns 12
/Division15 / 3 returns 5

Comparison Operators

OperatorDescriptionExample
<Less than5 < 10 returns true
>Greater than10 > 5 returns true
<=Less than or equal5 <= 5 returns true
>=Greater than or equal10 >= 5 returns true
==Equal to5 == 5 returns true
!=Not equal to5 != 3 returns true

Control Flow

If Statements

let age = 18
if age >= 18 {
  print "Adult"
}

While Loops

let count = 5
while count > 0 {
  print count
  let count = count - 1
}

Functions

Functions are defined using the func keyword and support parameters and return values.

func add(a, b) {
  return a + b
}

let result = add(10, 20)
print result

Function Scope

Functions have their own local scope. Variables passed as arguments are local to the function.

func increment(x) {
  let x = x + 1
  return x
}

let value = 5
let newValue = increment(value)
print newValue  # Prints 6
print value     # Prints 5 (unchanged)

Comments

FlowLang currently does not support inline comments. Use descriptive variable and function names for self-documenting code.