Mini Programs
Looking for guided practice?
Use Practice and Mini projects. This page is a catalog of short scripts — not a tutorial series.
Short scripts. Not a tutorial series.
Inline examples below run from any working directory. Commands that use examples/... paths require a git clone of this repository, with the shell cwd at the repo root (examples/ is not installed by pip/pipx).
Countdown
fn countdown(start: int) {
for i: int in start..0 by -1 {
say(i);
}
}
countdown(3);3
2
1
0Frequency counter
words: list = ["a", "b", "a"];
counts: hash = {};
i: int = 0;
while i < words.length() {
word: str = words[i];
counts[word] = counts.ensure(word, 0) + 1;
i = i + 1;
}
say(counts);{"a": 2, "b": 1}JSON job report
examples/json_report.echo reads a JSON suite, prints a summary, and can write it back out.
elang examples/json_report.echo -- examples/sample_jobs.json
ECHO_REPORT=report.json elang examples/json_report.echo -- examples/sample_jobs.jsonUses args(), envOr(), readFile(), writeFile(), parseJson(), and writeJson().
Bank account
Interactive class demo: examples/bank_account.echo (also in the playground).
elang examples/bank_account.echoCommands: deposit / withdraw / balance / exit (short: d w b q). Amounts use asFloatOr.
URL and Base64
examples/url_and_base64.echo builds a query URL and round-trips Base64 (no network). Also in the playground.
elang examples/url_and_base64.echoUses urlQuery / urlJoin, base64Encode / base64Decode, and httpOk / httpRedirect (status helpers only). Live httpGet needs the CLI host (allow_http=True); the playground denies it (E2801).
std/… imports
examples/std_imports.echo imports helpers from "std/meta", "std/url", "std/base64", and "std/http" (status helpers only). Also in the playground.
elang examples/std_imports.echoYAML and math
examples/yaml_and_math.echo round-trips YAML via "std/yaml", uses "std/math", and shows trace (playground-safe). Also in the playground.
elang examples/yaml_and_math.echoNested modules (CLI)
examples/modules_demo/ shows nested + ./ imports beside std/meta:
elang examples/modules_demo/app.echo2+3 = 5
6^2 = 36
std ready: true