dryLang
docsplaygrounddownloadgithub

Getting Started

  • Home
  • Getting Started
  • Setup

Language Basics

  • Variables
  • Types
  • Operators
  • Comments
  • Strings

Control Flow

  • Control Flow
  • Loops

Advanced Concepts

  • Functions
  • Structs
  • Collections
  • Modules
  • HTTP Server
  • Database

Reference

  • Built-ins
  • Error Handling
  • Errors

Examples

  • Hello
  • Variables
  • Functions
  • Control Flow
  • Structs
  • Arrays Maps
  • Try Err
  • Imports
  • Math
  • Strings
  • Http Server
  • Database
  • File Io

Templates

  • Automation
  • Cli Tool
  • Crud
  • Fetch Json
  • File Server
  • Hello
  • Html Render
  • Rest Api
Docs Menu

Getting Started

  • Home
  • Getting Started
  • Setup

Language Basics

  • Variables
  • Types
  • Operators
  • Comments
  • Strings

Control Flow

  • Control Flow
  • Loops

Advanced Concepts

  • Functions
  • Structs
  • Collections
  • Modules
  • HTTP Server
  • Database

Reference

  • Built-ins
  • Error Handling
  • Errors

Examples

  • Hello
  • Variables
  • Functions
  • Control Flow
  • Structs
  • Arrays Maps
  • Try Err
  • Imports
  • Math
  • Strings
  • Http Server
  • Database
  • File Io

Templates

  • Automation
  • Cli Tool
  • Crud
  • Fetch Json
  • File Server
  • Hello
  • Html Render
  • Rest Api

Data Types

dryLang is dynamically typed. Variables can hold any type, and the type is determined at runtime.

Number

Numbers represent both integers and floating-point values. Internally, all numbers are stored as 64-bit floats.

drylang
x 42          // integer
y -17         // negative
z 3,14        // float (comma = decimal point)
big 1000000   // large number

Float Decimal Rule

dryLang uses comma (,) as the decimal separator — the dot (.) is reserved for comments.

SyntaxMeaning
89,5Float 89.5 (no space after comma)
89, 5Two separate values (space after comma = separator)
fn(a, b)Two parameters (comma followed by space)
drylang
pi 3,14          // float 3.14
coords [45,5, 90,2]   // array of two floats: 45.5 and 90.2 — no! this won't work
coords [45,5, 90,2]   // comma-space = separator, so this is [45.5, 90.2] ✓

String

Strings are sequences of characters enclosed in double or single quotes.

drylang
greeting "Hello, World!"
name 'Zaky'

Both " and ' are equivalent — both support interpolation and escape sequences.

Escape Sequences

EscapeCharacter
\nNewline
\tTab
\\Backslash
\"Double quote
\'Single quote

| \0 | Null character |

drylang
pt "Line 1\nLine 2"
pt "Tab\there"
pt "Price: \$100"

String Interpolation

Use ${} inside strings to embed expressions:

drylang
name "Zaky"
age 17

pt "Hello, ${name}!"
pt "${name} is ${age} years old"
pt "2 + 3 = ${2 + 3}"
pt "First color: ${colors[0]}"
pt "Config host: ${config.host}"

Raw Strings

Raw strings are enclosed in backticks (`). No interpolation or escape processing occurs:

drylang
pattern `\d+\.\w+`
path `C:\Users\zaky\Desktop`
template `Hello ${name}`    // literal "${name}", not interpolated

Raw strings are ideal for regex patterns and file paths.

Boolean

dryLang uses single-character boolean values:

ValueMeaning
ttrue
ffalse
drylang
active t
deleted f

if active {
  pt "Active!"
}

Unknown

unknown is a special value representing an uninitialized or undetermined state.

drylang
? status         // declares unknown bool
pt status        // prints "unknown"

//  Functions without rev return unknown 
fn do_stuff() {
  pt "doing stuff"
}
x = do_stuff()
pt x             // prints "unknown"

Truthiness

ValueTruthy?
t✅
f❌
0❌
"" (empty string)❌
[] (empty array)❌
{} (empty map)❌
unknown❌
Any other number✅
Any non-empty string✅
Any non-empty collection✅

Type Checking

Use the get() built-in to check a value's type at runtime:

drylang
pt get(42)        // prints "number"
pt get("hello")   // prints "string"
pt get(t)         // prints "bool"
pt get([1,2,3])   // prints "array"
pt get({"a": 1})  // prints "map"
pt get(greet)     // prints "fn"

get() returns one of: "number", "string", "bool", "array", "map", "fn", "unknown".

PreviousVariablesNextOperators