dryLang
docsplaygrounddownloadgithub

Welcome

  • Home

Getting Started

  • Overview
  • Installation
  • CLI Usage

Basics

  • Overview
  • Variables
  • Data Types
  • Operators
  • Comments

Control Flow

  • Overview
  • Conditionals
  • Loops
  • Error Handling

Functions

  • Overview
  • Definition
  • Scope & Closures

Data Structures

  • Overview
  • Structs & Classes
Docs Menu

Welcome

  • Home

Getting Started

  • Overview
  • Installation
  • CLI Usage

Basics

  • Overview
  • Variables
  • Data Types
  • Operators
  • Comments

Control Flow

  • Overview
  • Conditionals
  • Loops
  • Error Handling

Functions

  • Overview
  • Definition
  • Scope & Closures

Data Structures

  • Overview
  • Structs & Classes

Operators

DryLang supports standard arithmetic, comparison, and logical operators.

Arithmetic

drylang
a = 10 + 5   // 15
b = 10 - 5   // 5
c = 10 * 5   // 50
d = 10 / 5   // 2
e = 10 % 3   // 1

Comparison

drylang
isEqual = (a == b)
isNot = (a != b)
isGreater = (a > b)
isLess = (a < b)
isGtEq = (a >= b)
isLtEq = (a <= b)

Logical

drylang
andOp = (t & f)  // false
orOp  = (t | f)  // true
notOp = !t       // false

Nullish Coalescing (??)

Returns the right-hand side if the left is unknown.

drylang
userInput = unknown
name = userInput ?? "Guest"
pt(name) // "Guest"

Optional Chaining (?.)

Safely access nested properties without crashing on unknown.

drylang
result = obj?.field
PreviousData TypesNextComments