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!
- Install the toolchain:
- For macOS and Linux, run our script:
curl -sL https://raw.githubusercontent.com/lambdaclass/cairo-by-example/main/build/installer.sh | bash -s 2.2.0
- For Windows and others, please see the official guide
- Run the example:
- Copy the example into a hello-world.cairo file and run with:
cairo-run --single-file hello-world.cairo