Your First Program

Let's walk through creating, formatting, and running your very first Djazair application.

Writing "Hello World"

Create a file named hello.dz in your project directory using any text editor:

djazair
# hello.dz — My first script in Djazair
let greeting = "Hello from Djazair!"
print(greeting)

Executing the Script

To run your script, pass the file path to the djazair interpreter:

bash
djazair hello.dz
# Output:
# Hello from Djazair!

Prompting for User Input

Djazair provides the built-in input(prompt) function to read text input from the console:

djazair
# interactive.dz
let name = input("Enter your name: ")
let city = input("Where are you from? ")

print("Welcome, ${name}! Greetings to everyone in ${city}.")

When run, the program prompts you in the terminal:

bash
djazair interactive.dz
# Enter your name: Riad
# Where are you from? Algiers
# Welcome, Riad! Greetings to everyone in Algiers.

Comments in Djazair

Documentation is a vital part of every codebase. Djazair supports both single-line and multi-line comments:

djazair
# 1. Single-line comment starts with a hash character (#)
let x = 10 # This comment follows code

#*
   2. Multi-line comments are wrapped in #* ... *# blocks.
   They can span across multiple lines and are ideal
   for file headers or detailed algorithmic documentation.
*#
let y = 20