Skip to content

Latest commit

History

History

README.md

kvlang Tutorial

A progressive, step-by-step guide to kvlang.
Each numbered directory contains a standalone main.kv you can run immediately.
08-algo/ is a collection of complete programs — run any file directly.

Steps

StepTopicWhat you'll learn
01-helloHello Worldprint, terminal activation
02-varsVariablespath-based read/write (./x)
03-arithArithmetic+ - * /, pow, sqrt, abs, max, min
04-funcFunctionsdef, call, arguments, write params
05-ifConditionalsif/else, boolean operators && || !
06-whileWhile Loopswhile, break, continue
07-recursionRecursionmulti-write params, tail-call optimization
08-algo/Algorithmsfibonacci, fizzbuzz, gcd, collatz, …

Running

# numbered steps — each prints its own output
kvlang tutorial/01-hello/main.kv
kvlang tutorial/06-while/main.kv
# ...# algo showcase — any file is self-contained
kvlang tutorial/08-algo/fibonacci.kv # fib = 55
kvlang tutorial/08-algo/fizzbuzz.kv # FizzBuzz 1-15
kvlang tutorial/08-algo/gcd.kv # gcd = 6
kvlang tutorial/08-algo/collatz.kv # steps = 111

Algorithms in 08-algo

FileAlgorithmKey concepts
fibonacci.kvIterative Fibonacciwhile, variable swap
factorial.kvIterative Factorialwhile accumulator
fizzbuzz.kvFizzBuzz 1–15modulo, nested if
gcd.kvGCD (Euclidean)tail recursion
power.kvFast power (loop)while, counter
classify.kvGrade classifiernested if, string literal
collatz.kvCollatz conjecturewhile, even/odd branch
tco_depth.kvTCO verificationwhile → goto, tail recursion
scope_isolation.kvFrame isolationmulti-write params, call isolation