Day 1: Hello Rust
EasyBasicsVariablesprintln!

Day 1: Hello Rust

Welcome to your Rust journey! Today we'll write our first Rust program and learn the fundamentals.

Rust is a systems programming language focused on safety, speed, and concurrency. It's the language of choice for Solana programs!

What You'll Learn

  • Declaring variables with let
  • Basic string types
  • The println! macro for output
  • String interpolation with {}

The Task

Create a variable called name with the value "Rustacean" and print a greeting message.

Key Concepts

Variables

In Rust, variables are declared with let:

let x = 5;           // immutable by default
let mut y = 10;      // mutable with 'mut'

The println! Macro

Use println! to print to the console:

let name = "World";
println!("Hello, {}!", name);  // Output: Hello, World!

Requirements

  • Create a variable name with the value "Rustacean"
  • Print exactly: Hello, Rustacean! Welcome to Rust.

Hints

Make sure your output matches exactly - including punctuation and spacing!

  • Use let to declare the variable
  • Use println! with {} for interpolation
  • The string must be a &str literal (in quotes)
Language: Rust
1
2
3
4
5
6
7
8
Output
Run to see the result here.
    Day 1: Hello Rust · RUST Challenge | learn.sol