Skip to content

seanpm2001/Learn-Rust

Repository files navigation


/Rust_programming_language_black_logo.svg

Learning Rust

I started learning the Rust programming language before using GitHub, but increased its usage afterwards. I have found it to be a fast and stable language.

In 2021 on GitHub, I participated in Ruffle-RS and did basic code reviews, and learnt the language slightly better via communication on issues.

I don't know too much about the language, this document will go over all my knowledge of the Rust programming language so far.

Comments in Rust

Comments in Rust are similar to that of C, C++, C#, CSS.

// This is a single line comment
/* This 
is a multi-
line com-
ment */

Hello World in Rust

Rust's print statement uses an exclamation point. It is slightly strange to me.

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

Break keyword in Rust

break;

To this day, I am still not entirely sure what the break keyword does, but most languages support it.

/!\ This example has not been tested yet, and may not work

Booleans in Rust

Rust supports Booleans. This example includes content that will be mentioned in further entries. This example is not the best, I came up with it on the fly.

// Checking if a value is greater or less than 0
let valueT: bool = true;
let valueF: bool = false;
int x = -33
if (x > 0) {
	return valueT();
} else {
	return valueF();
}

/!\ This example has not been tested yet, and may not work

Integers in Rust

Rust supports integers, as like almost all programming languages.

let x: int = 2;
return x();

/!\ This example has not been tested yet, and may not work

If and else statements in Rust

Rust supports if and else statements, as like almost all modern programming languages.

let x: int = 1;
if (x > 0) {
	println!("You entered a value at or below 0");
} else {
	println!("You entered a value at or above 0");
}

/!\ This example has not been tested yet, and may not work

Other knowledge of the Rust programming language

  1. Rust is a semicolon and curly bracket language

  2. Rust uses the .rs file extension.

  3. Rust is used in many major projects, notably including the Firefox web browser, Ruffle-RS, and more.

  4. Rust developers are known as rustaceans similar to how Python developers are known as pythoneers or pythonistas

  5. Rust is a highly stable language

  6. No other known knowledge of the Rust programming language at the moment