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

Comments

dryLang uses C-style comments with // for single-line and /* */ for multi-line.

Single-Line Comments

drylang
// This is a comment
pt "Hello"  // inline comment

Everything after // until the end of the line is ignored.

Multi-Line Comments

drylang
/*
This is a multi-line comment.
It can span as many lines as you need.
*/

Inline Comments

drylang
name "Zaky"    // assign name
age 17         // user age
PI 3.14        // constant

Nested Content in Comments

Comments can contain code-like text, URLs, and any punctuation:

drylang
// This function calculates the sum of two numbers
fn add(a, b) {
    rev a + b
}

/*
TODO: Add support for http://example.com
This will be added in v2.0
See: https://github.com/user/repo
*/

Comment Best Practices

drylang
// Good: explains WHY
// Skip negative values because they indicate errors
lp len(data) {
    if data[i] < 0 { con }
    pt data[i]
}

// Bad: explains WHAT (obvious from code)
// Loop through data and print
lp len(data) {
    pt data[i]
}
PreviousOperatorsNextStrings