Aditya Gupta

Aditya Gupta

Every Operator in Rust Explained

Rust supports standard operators for arithmetic (+, –, *, /), comparison (==, !=, <, >), and logic (&&, ||, !). These operators work on numbers, booleans, and some custom types, making them essential for performing calculations and decisions in your…

Working with Strings in Rust

Rust has two main string types: &str (a string slice) and String (a growable, heap-allocated string). &str is usually used for static or borrowed strings, while String is used when you need to modify or own the string data. In…

Rust Primitive Data Types

Rust has four main categories of scalar primitive types: integers, floating-point numbers, booleans, and characters. These types are built into the language, fixed in size, and form the foundation of all value handling in Rust programs. To write useful programs…

Variable Shadowing and Scope in Rust

In Rust, variable shadowing lets you reuse the same variable name in the same or a nested scope. Each shadowed variable is a new binding, which allows transformations or type changes without using a new name. When learning how Rust…

Type Annotations and Inference in Rust

Rust is a statically typed language, which means every variable must have a type known at compile time. You can either write this type explicitly using type annotations, or let Rust figure it out automatically using type inference. Rust aims…

Variables and Mutability in Rust

In Rust, variables are declared using let. By default, all variables are immutable, which means you cannot change their values. To make a variable mutable, add mut like this: let mut x = 5. This is different from JavaScript, where…

Hello, World! – Your First Rust Program

To write your first Rust program, use cargo new project_name, then open main.rs and add a main function with a println! macro. This prints a message to the terminal. Rust programs always start from the main function. Once your Rust…

Review Your Cart
0
Add Coupon Code
Subtotal