Larzscript Course · Lesson 9 of 15

Money-Native Basics — Wallet, Price, Pay

Larz covers the thing that makes Larzscript different: wallet and price are real types that print as currency, and pay moves money between wallets as a single, safe statement - no library required.

wallet and pay

wallet holds real money, price names an amount, and pay AMOUNT from A to B transfers it - all in the language itself:

wallet alice = $50.00
wallet bob = $10.00

pay $20.00 from alice to bob

print("alice:", alice.balance)
print("bob:", bob.balance)
Output
alice: $30.00
bob: $30.00

price and insufficient funds

pay checks the balance for you - try to pay more than a wallet holds and it throws, the same try/catch from last lesson:

wallet alice = $10.00
price ticket = $25.00
wallet venue = $0.00

try {
    pay ticket from alice to venue
} catch e {
    print("payment failed:", e["message"])
}
print("alice:", alice.balance)
Output
payment failed: wallet 'alice' has insufficient funds (line 6)
alice: $10.00

Every snippet on this page is run through the real larzscript interpreter, not hand-typed — what you see in the Output blocks is the actual output, for everything shown: a real transfer and a real rejected payment.

← Lesson 8Course syllabusGitHub