Overview
The Hello World example is the simplest possible Dryft program. It demonstrates the basic structure of a Dryft program and how to output text to the console.Source Code
What This Example Demonstrates
This example shows:- Module inclusion: Using
include: std/ioto import standard I/O functionality - Action definition: Defining the
mainaction, which is the entry point of the program - String output: Using the
printsfunction to output a string to the console - Basic syntax: The stack-based nature of Dryft where data comes before operations
How It Works
- The program includes the standard I/O module which provides the
printsfunction - The
mainaction is defined as the program’s entry point - The string
"Hello, World!\n"is pushed onto the stack - The
printsfunction pops the string from the stack and outputs it to the console - The semicolon
;terminates the action body
In Dryft, operations are stack-based, meaning data is pushed onto a stack and operations consume values from the stack.