cairo by example

hello world

the use keyword imports a dependency into scope

use debug::PrintTrait;

fn main() {
    'Hello, world!'.print();

now, run the tests with cairo-run --single-file hello_world.cairo. Running this will yield:

[DEBUG]	Hello, world!                  	(raw: 0x48656c6c6f2c20776f726c6421

Run completed successfully, returning []

Try it out!
  1. Install the toolchain:
    • For macOS and Linux, run our script:
    • curl -sL | bash -s 2.2.0
    • For Windows and others, please see the official guide
  2. Run the example:
    1. Copy the example into a hello-world.cairo file and run with:
    2. cairo-run --single-file hello-world.cairo


next (assert)