The Rust Programming Language

The Rust Programming Language — Primitives — String

Ankit Tanna
Rustaceans
4 min readOct 6, 2023

--

We will learn about Primitive types in Rust programming language. One of the very first type is string.

Rust files have an extension of .rs

Step 1: Install Rust

You need to install Rust on your computer before you can start compiling Rust code.

After installing the rust, you will have access to rustc which is a way to invoke Rust compiler to read through your files and compile them to executables.

Step 2: Create a rust file

We’ll now create a rust file: app.rs

Below is the code snippet for reference:

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

Step 3: Observations from code

  1. fn is the keyword for function
  2. main is the first function that gets triggered, just like programming languages like Java
  3. A function call has an ! at the end of the name of the function. We’ll address that in upcoming posts
  4. println is the function which is equivalent to console.log in JavaScript or System.out.println in Java

Step 4: Compiling the code

--

--