Logo
Logo
249 results for
  • I once reviewed a pull request that had seven levels of nested if-else. In Go. The author said “the language doesn’t give me better tools.” In Rust, you’ve got match, labeled loops, if let, and blocks-as-expressions — enough to keep your code flat and readable even when the logic is complex.

    if / else

    fn main() {
        let temperature = 35;
    
        if temperature > 30 {
            println!("It's hot");
        } else if temperature > 20 {
            println!("It's nice");
        } else {
            println!("It's cold");
        }
    }
    

    Standard stuff. No parentheses around the condition — that’s a syntax error in Rust. The braces are mandatory, even for single-line bodies. No arguing about whether to use braces. They’re required. Discussion over.

    Rust tutorial rust beginner Created Thu, 14 Mar 2024 19:10:00 +0000
  • One of my early interview mistakes was throwing a hash map at every array problem. It works a surprising amount of the time, but there’s a whole class of problems where you don’t need extra space at all — where the structure of the input lets two indices do the work together. Two pointers is that technique, and once you see it, you cannot unsee it.

    The pattern shows up at every company. Amazon loves it for stream-processing problems. Google uses it for geometry and partition questions. Meta favors it in string validation and deduplication. Three Sum alone has appeared in more on-site rounds than I can count.

    fundamentals interviews Created Thu, 14 Mar 2024 00:00:00 +0000
  • When I first read that “everything in Rust is an expression,” I thought it was marketing fluff. It’s not. It’s a genuine design principle that affects how you write code every single day, and once you internalize it, going back to statement-heavy languages feels clunky.

    Defining Functions

    fn add(a: i32, b: i32) -> i32 {
        a + b
    }
    
    fn main() {
        let result = add(3, 7);
        println!("3 + 7 = {result}");
    }
    

    A few things to notice:

    Rust tutorial rust beginner Created Wed, 13 Mar 2024 10:20:00 +0000
  • One of the first things people told me about Go was “it makes concurrency easy.” I was sceptical — concurrency is never easy. But the more I used goroutines, the more I understood what they meant. It’s not that concurrency becomes simple. It’s that the cost of starting a concurrent task drops so low that you stop avoiding it.

    In most languages, spawning a thread involves megabytes of stack memory and significant overhead. A Go goroutine starts with about 2KB of stack. You can run tens of thousands of them on a normal laptop without breaking a sweat.

    Go tutorial golang beginner Created Tue, 12 Mar 2024 00:00:00 +0000
  • Coming from JavaScript, I was stunned the first time Rust refused to compile because I tried to reassign a variable. “What do you mean it’s immutable by default? Who designs a language like that?” Turns out — people who’ve debugged enough mutable state to know better.

    Variables with let

    fn main() {
        let x = 5;
        println!("x is {x}");
    }
    

    let creates a variable binding. It binds a name to a value. By default, that binding is immutable — you can’t change it.

    Rust tutorial rust beginner Created Mon, 11 Mar 2024 16:45:00 +0000
  • The first program I ever wrote was in BASIC on a Commodore 64 emulator. Took me twenty minutes to figure out why PRINT didn’t work (I was typing PIRNT). Rust’s version of Hello World looks simple — four lines — but there’s a surprising amount of language design packed into those four lines.

    The Program

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

    That’s it. Three lines if you’re counting. But each piece tells you something about how Rust thinks.

    Rust tutorial rust beginner Created Sat, 09 Mar 2024 11:00:00 +0000
  • I’ve installed Rust on maybe fifty machines at this point — Linux servers, Macs, Windows boxes, even a Raspberry Pi. The process has gotten remarkably smooth. Rustup is one of the best toolchain managers in any language ecosystem, and I say that without hesitation.

    Installing rustup

    Rustup is the official Rust toolchain installer and manager. It handles downloading the compiler, updating it, and switching between versions. One command gets you everything.

    Rust tutorial rust beginner Created Thu, 07 Mar 2024 14:30:00 +0000
  • The first time I wrote Go after years of Python and JavaScript, I kept waiting for the try/catch block. It never came. Instead, almost every function returned two values: the result, and an error. I had to check the error every single time. It felt tedious at first. After a few weeks, I realised it was one of the best design decisions in the language.

    In Go, errors are just values. They’re not special. They don’t teleport up the call stack. They sit right there, in your return value, waiting for you to deal with them.

    Go tutorial golang beginner Created Wed, 06 Mar 2024 00:00:00 +0000
  • I mass-deleted a production database once because a C program I’d written had a use-after-free bug that corrupted a pointer used for query routing. Took us fourteen hours to recover. That was the week I started learning Rust.

    The Problem Rust Solves

    Every few years, someone publishes a study on CVEs in major software projects. The numbers are always the same: roughly 70% of critical security vulnerabilities in C and C++ codebases are memory safety issues. Buffer overflows, use-after-free, double-free, null pointer dereferences. The same bugs, decade after decade.

    Rust tutorial rust beginner Created Tue, 05 Mar 2024 09:15:00 +0000
  • When I was preparing for my first round of FAANG interviews, I was overwhelmed. Hundreds of LeetCode problems, dozens of patterns, no clear starting point. Then I noticed something: roughly a third of the medium-difficulty problems I encountered could be cracked with one insight — trading time for space using a hash map. Once I internalized that, arrays and hashing stopped feeling like a category and started feeling like a reflex.

    fundamentals interviews Created Sun, 03 Mar 2024 00:00:00 +0000