The Keyword Reference

Lolrust ships in two flavors: Beginner and Classic. Both transpile to identical Rust. Both are valid. Pick whichever vibe fits your day.

The Beginner aliases were added in 0.2.0 for the Meowademy lessons, where reading make x = 5 is friendlier than reading i can haz x = 5 to a hooman who has never met a cat. The Classic spellings are the original lolrust and remain fully supported. Mixing them in one file is permitted but the cat will sigh.

Where a row says ~ in a column, that form does not exist. Where a row lists multiple words, both spellings transpile to the same Rust.

Bindings

BeginnerClassicRustWhy
makei can hazletthe original
make wigglyi can haz wigglylet mutit wiggles because it can change
~foreverconstforever and ever
~stickycatstatica cat that won’t move

Control Flow

BeginnerClassicRustWhy
whenif ceiling cat sezifceiling cat watches over all
~or if ceiling cat sezelse ifceiling cat has more to say
otherwiseor basement cat sezelsethe dark alternative
do thiszoomzoomloopso much energy it zooms twice
~furrever / chaseforcats chase things
~aroundinchase things around
repeat whileprowlwhilea cat on patrol
~skritch dat / sniffmatchcats investigate by sniffing
~nap / flopbreakcat naps, loop stops
~againcontinuedo it again
~yeet / cough upreturnlike a hairball, but it’s a value

Functions and Structures

BeginnerClassicRustWhy
~izfnbecause everything iz something
~loafstructcats are just loaves
~pounce / teechimplteach the loaf new tricks
~flavurzenumdifferent flavors of a thing
~skillztraitwhat a kitteh can do
~kindatypekinda like a type alias
~purrive(...)#[derive(...)the cat has arrived, with derived traits

Modules and Visibility

BeginnerClassicRustWhy
~gimmeusegimme that module
~boxmodcats love boxes
~everycatpubvisible to everycat
~chonksuperthe big cat one level up
~bigchonkcratethe biggest chonk, the whole crate

Modifiers

BeginnerClassicRustWhy
~wigglymutit wiggles
~yolounsafeyou only live once (cats have 9 tho)
~lazeeasyncwill do it later
~waitforitawait…wait for it…
~yoinkmoveYOINK! mine now
~copycat.clone()makes a copy of ur cat
~pretend izaspretend it’s something else
~but only ifwhereconditions apply

Self and Path

BeginnerClassicRustWhy
~disselfdis right here
~DisSelfDis type right here

Macros

BeginnerClassicRustWhy
say / bigsaymeow!println!cats meow, programs print
yellhisss!eprintln!angry output
~ohno!panic!oh no

The Beginner macros (say, bigsay, yell) work without the ! because they’re not technically macros at the lolrust level ~ they get rewritten directly to println! and eprintln! during transpile. The Classic forms (meow!, hisss!, ohno!) keep the ! for visual continuity with their Rust counterparts.

Types

LolRustRustWhy
YarnStringcats love yarn
PileVeca pile of things
CardboardBoxcats WILL sit in the cardboard
MaybeCheezburgrOptionmaybe there’s a cheeseburger, maybe not
TryzResulttry and see what happens

Types do not have Beginner aliases. The cat felt that Yarn was already simple enough.

Type Variants

LolRustRustWhy
Has(value)Some(value)it has the thing
EmptyBowlNonethe bowl is empty :(
Purrfect(value)Ok(value)purrfect, no errors
Hairball(error)Err(error)coughed up a hairball

Booleans

LolRustRust
yustrue
nopefalse

Word-Boundary Safety

The transpiler respects word boundaries, so the following do not get mangled.

dismiss() stays as dismiss(). The keyword dis is hiding inside dismiss, but the boundary check refuses to replace it.

wizard stays as wizard. The keyword wiggly is not a prefix of wizard, and even if it were, the trailing word character would block the substitution.

iz_chonky stays as iz_chonky. Underscores count as word characters, so the keywords iz and chonk cannot leak into a snake_case identifier.

If you discover a case where the transpiler eats part of a name it should not, file an issue. The cat will pretend to investigate.

Longest-Match-First

Multi-word keywords are matched longest-first, which is why i can haz wiggly x = 5; correctly becomes let mut x = 5; rather than the syntactically broken let wiggly x = 5;. You do not need to think about this. The cat already thought about it.

Beginner Alias Caveat

The Beginner aliases trade native lolcat feel for clarity. If you want your code to read as authentic lolcat, prefer the Classic spellings. If you want your code to read as a tutorial, prefer the Beginner spellings. If you want your code to read as a tutorial that becomes lolcat halfway through, mix freely. The cat does not care, although it has opinions.

Versions

This reference is current as of lolrust 0.2.0. The Beginner aliases were introduced in 0.2.0; everything in the Classic column was already present in 0.1.x.

If you are reading this from a future where lolrust has grown additional keywords, the canonical source is src/keywords.rs in the repo. That file is sorted longest-first for the longest-match logic above and is the authority. This page is its translation for hoomans.