comments
In Cairo programs, any text after a pair of forward slashes (//
) and until the end of the line will be ignored by the compiler.
You can use this to leave explanatory comments in your code.
fn main() -> felt252 {
// start of the function
1 + 4 // return the sum of 1 and 4
}
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 comments.cairo file and run with:
%!s(<nil>) comments.cairo