I decided to start ziglings because I wanted to learn a low-level language. I’ve been curious about Zig for a while, and its syntax pulled me in – it feels modern but still close to C. These first exercises gave me a foundation in variables , types, and functions. Here are my notes.
Variables and Types
Zig doesn’t let you be sloppy with variables. You have to be explicit:
const pi: f32 = 3.14; // immutable
var count: i32 = 0; // mutable
Zig- const means the value never changes.
- var means the value can change.
- Types are strict, which makes code easier to reason about.
Functions and Scope
Function in zig are clean and direct:
fn add(a: i32, b: i32) i32 {
return a +b;
}
Zig- You must declare parameter and return types
- return is always explicit – no hidden return values.
- scope rules are tight; you always know where a variable lives
First Impressions
Zig reminds me of C, but with better readability. I haven’t written a lot of C other than what cs50 asked for, but it is similar.
Definitely harder than JavaScript.
The big takeaway so far is that Zig forces you to write code that’s clear and intentional.
Next up in Ziglings, I will be diving into control flow: if statements, loops and eventually switch statements. I’m curious to see how they compare to what I know from JS and Rust.