My First Rust Program

println!(“Hello, World!”);

Rusty metal texture

My first post on Rust programming (well, you could go back and read my welcome post), but my first Rust program anyway… oh what will it be!? Well, I’m boring and predictable, so a Hello World app sounds perfect!

What to expect

This is not going to be a hold-your-hand Rust learning experience. I’m planning that you will read along in the Rust books (both the online, supplied one and maybe an O’Reilly book I am reading it on their Online Learning site) and get Rust installed yourself and start programming. I’m just documenting my travels through the Rust world as I try to teach an old dog (me) some new tricks.

June 17,2019 and I’m starting off with Rust version 1.35.0, and with no further delay, my first Rust program!

fn main() {
  println!("Hello, World!");

The book I’m following is keeping it a secret why I am using the println! macro instead of the actual println call, but that’s ok, I can live with secrets.

Starting steps

BTW, I used the Rust-supplied management program cargo to get this started:

cargo init hello_cargo
cd hello_cargo
<edit src/>
cargo test
cargo run

Of course, passing zero tests is easy!

Ok, I haven’t written in C in 30 years (or in Pascal for a few more than that), but this feels vaguely familiar and there’s not really much to learn here, as usual with a Hello, World script. The curly braces and semi-colons feel right at home in my perl brain.

Note: after a link indicates the link is an Amazon affiliate link