Chapter 4

Chapter 4: Writing Your First Rust Program

Let’s write a simple Rust program to get familiar with the language.

Task

Write a program that prints "Hello, Solana!".

Code

fn main() {
    println!("Hello, Solana!");
}

Compilation and Execution

Use cargo run to compile and run the program.


Page Layout:

  • Header: Fixed top bar with "Solana Learn" logo, navigation, and profile icon.

  • Main Content:

    • Left Panel (50%): This text content.

    • Right Panel (50%): Code editor with the Rust program.

  • Footer: Link to Rust println! Docs.

Visuals:

  • Code Editor: Rust code with syntax highlighting.

  • Output Panel: "Hello, Solana!" displayed below.

Interactivity:

  • Edit the code (e.g., change message) and see real-time output.

Last updated