QuackScript Web Shell

QuackScript Documentation

Introduction

QuackScript is a whimsical, duck-themed programming language with dynamic execution behavior. The language features a "duck mood" system that affects how your code runs, random weather events, and playful built-in functions.

Basic Syntax

Variables

Declare variables using the VAR keyword:

VAR x = 10
VAR name = "Duck"
VAR myList = [1, 2, 3]

Data Types

Comments

Use # for single-line comments:

# This is a comment
VAR x = 5

Operators

Arithmetic: +, -, *, /, ^ (power)

Comparison: ==, !=, <, >, <=, >=

Logical: AND, OR, NOT

List Operations:

Control Flow

If Statements

Single-line:

IF x > 10 THEN PRINT("Big") ELSE PRINT("Small")

Multi-line:

IF x > 10 THEN
    PRINT("Big number")
    VAR y = x * 2
END

Loops

For Loop:

FOR i = 0 TO 10 THEN PRINT(i)

While Loop:

VAR x = 0
WHILE x < 10 THEN VAR x = x + 1

Loop Control:

Functions

Function Definition

Single-line (arrow syntax):

FUN add(a, b) -> a + b

Multi-line:

FUN greet(name)
    VAR message = "Hello, " + name
    PRINT(message)
    RETURN message
END

Built-in Functions

I/O Functions

Type Checking

List Functions

Duck-Themed Functions

Constants

Examples

Factorial Function

FUN factorial(n)
    IF n <= 1 THEN
        RETURN 1
    ELSE
        RETURN n * factorial(n - 1)
    END
END

PRINT(factorial(5))

List Processing

VAR numbers = [1, 2, 3, 4, 5]
VAR sum = 0

FOR i = 0 TO LEN(numbers) THEN
    VAR sum = sum + (numbers / i)
END

PRINT(sum)