Homeโ€บBlogโ€บLarzscript
Larzscript

Larzscript Tutorial: Your First Money-Native Program

2026-08-01 ยท Larzscript

This is a hands-on first program in Larzscript, the language where wallets, payments and prices are keywords instead of a library. You can follow along in two ways: install the real binary, or use the in-browser playground and skip the install entirely.

Install it (optional โ€” skip if you're using the playground)

One line on Linux/macOS:

curl -fsSL https://raw.githubusercontent.com/larz-scripter/larzscript/main/install.sh | sh

On Windows (PowerShell):

irm https://raw.githubusercontent.com/larz-scripter/larzscript/main/install.ps1 | iex

Or build it yourself โ€” it's one C file with zero dependencies:

cc -O2 -o larzscript native/larzscript.c
./larzscript -e "print(1 + 2)"

Step 1: ordinary code

Larzscript reads like most modern scripting languages. Save this as hello.lz:

let name = "world"
print(f"hello, {name}")

fn square(n) { return n * n }
print(square(6))

Run it with larzscript hello.lz, or paste it straight into the playground.

Step 2: give something a wallet

Now the part that's unique to this language. A wallet holds real money โ€” stored as cents internally, so arithmetic doesn't drift:

wallet me = $50.00
print(me.balance)          # $50.00

Step 3: set a price and require a balance check

wallet me = $50.00
wallet shop
price coffee = $4.50

fn buy_coffee(buyer) {
    require buyer.balance >= coffee, "not enough funds"
    pay coffee from buyer to shop
}
buy_coffee(me)
print(f"me: {me.balance}, shop: {shop.balance}")   # me: $45.50, shop: $4.50

require isn't a convention here โ€” it's a language-level guard. If the balance check fails, the pay statement after it never executes, full stop.

Step 4: split the payment

Real products usually need to route money to more than one place โ€” a platform fee, a creator payout. Same pay keyword, called twice:

wallet buyer = $20.00
wallet platform
wallet creator
price item = $9.00

fn purchase(who) {
    require who.balance >= item, "not enough funds"
    pay item from who to platform
    pay item * 0.8 from platform to creator
}
purchase(buyer)
print(f"creator earned: {creator.balance}")   # creator earned: $7.20

Step 5: try a subscription

Larzscript also has paywall and subscribe built in for recurring billing:

wallet customer = $20.00
wallet platform
paywall pro = $9.00 / month to platform

subscribe customer to pro
print(customer.balance)   # $11.00 - charged, paid, access granted

Where to go next

Ready to get started?

Everything here is free to try.

Try Larzscript now โ†’

Explore the apps