Hello World

Hello World

Cairo can be used to write StarkNet Smart Contracts.

The following is a Greeter Smart Contract that has a greet function which returns a simple greeting as a felt value.


# This declares that we're dealing with a StarkNet contract.
%lang starknet

# The `@view` decorator allows us to call `greet` externally.
func greet() -> (greeting : felt):
    # Internally the string is represented as a `felt`.
    let greeting_string = 'Hello World!'

    # Simply return the value of the `greeting_string` felt.
    return (greeting_string)