The Rust Programming Language — Primitives — String
Published in
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
fn
is the keyword for functionmain
is the first function that gets triggered, just like programming languages like Java- A function call has an
!
at the end of the name of the function. We’ll address that in upcoming posts println
is the function which is equivalent toconsole.log
in JavaScript orSystem.out.println
in Java