Skip to main content

Examples

The repository ships a set of runnable examples under examples/, one folder per topic. Each is a complete .scr program you can run directly with the interpreter:

./build/interpreter/scrii_repl examples/01_hello_world/hello.scr

Topic tour

Language fundamentals

FolderTopicWhat it shows
01_hello_worldHello worldMinimal program, print, basic script
02_typesTypesEvery value type and literals
03_control_flowControl flowif/elif, while, for, foreach, switch
04_functionsFunctionsNamed/anonymous functions, arguments, returns
05_arraysArraysConstruction, indexing, nesting
06_objectsObjectsKey/value maps, nesting, access
07_operatorsOperatorsArithmetic, comparison, logical, ternary, pipes
08_stringsStringsConcatenation, methods, std.string

Standard library

FolderTopicWhat it shows
09_mathMathstd.math functions and constants
10_file_ioFile I/Ostd.file read/write basics
11_jsonJSONstd.json parse/stringify
12_sortingSortingstd.sort algorithms
15_timeTimestd.time and timers
16_hashingHashingstd.hash md5/sha256/crc32
17_systemSystemstd.system, std.env, process basics
18_conversionsConversionsstd.convert number/base/string conversion
23_pathsPathsstd.path resolution and decomposition
27_compressionCompressionstd.compression zstd/lz4
28_imagesImagesstd.image load/info/save with sample files

Concurrency & networking

FolderTopicWhat it shows
14_asyncConcurrencystd.async spawn/await/defer
24_socketsSocketsstd.net TCP/UDP
25_httpHTTPstd.net HTTP client/server
26_crypto_filesCrypto filesstd.crypto encrypted file I/O

Integration & advanced

FolderTopicWhat it shows
13_importsImportsimport() and multi-file projects (libs/)
19_advanced_patternsPatternsIdiomatic/advanced Scrii patterns
20_text_adventureGameA small text-adventure program
21_pluginsPluginsload_plugin against a built shared library
50_tortureStressAggressive use of the interpreter

Some examples need build-time prerequisites to run fully:

  • 21_plugins requires the plugin shared library built first (see Native Plugins).
  • 26_crypto_files, 25_http (TLS), and 28_images need the optional OpenSSL / image backends to be present at build time (see Backends).

Suggested reading order

Start at 01_hello_world and work up roughly by folder number — the later examples (14_async, 20_text_adventure, 24_sockets, 25_http) assume the language and stdlib topics from the earlier ones. The 50_torture suite is a stress test more than a tutorial and is a good thing to run after installing a new build.