Skip to content
OFFICIAL SS DOCUMENTATION

Tested examples

Complete examples from the official SS documentation. Each one includes its expected result and a link to its source.

Arrays, continuation, and control flow

Complete executable V1 source from the authoritative language specification.

arrays
indexing
if
line continuation
SS source
let forces = [10, 20, 30]
let area = 200

let total = (
    forces[0]
    + forces[1]
    + forces[2]
)

if total == 60 {
    printLine("Solved", total)
}

Expected: Solved 60

Source: Docs/SPECIFICATION.md, Language V1.Open in SS Lab

Physical quantities and custom units

Dimensioned literals, derived quantities, and a user-defined multiplicative unit.

units
dimensions
quantities
engineering
SS source
let force = 20 kN
let area = 200 mm^2
let stress = force / area

unit furlong = 201.168 m
let distance = 3 furlong

printLine(force)
printLine(stress)
printLine(distance)

Expected: 20 kN; 100000000.00000001 m^-1*kg*s^-2; 3 furlong

Source: Docs/SPECIFICATION.md, Language V1.Open in SS Lab

Descriptive statistics

Summarize a measured sample using the verified SS.Statistics package example.

packages
statistics
records
arrays
SS source
module Main
import Statistics

let result = Statistics.summarize([12.0, 15.0, 13.0, 10.0, 15.0])
printLine("count", result.count, "mean", result.mean, "sample variance", result.sampleVariance)

Expected: count 5, mean 13, sample variance 4.5

Source: Examples/ProfessionalFreePackages/SS.Statistics/Beginner/main.ss.Open in SS Lab

Constant-acceleration motion

Compute position and velocity with the verified SS.Mechanics beginner example.

packages
mechanics
kinematics
records
SS source
module Main
import Mechanics

let motion = Mechanics.constantAcceleration(0.0, 0.0, 9.81, 2.0)
printLine("position_m", motion.position, "velocity_m_per_s", motion.velocity)

Expected: position_m 19.62, velocity_m_per_s 19.62

Source: Examples/ProfessionalFreePackages/SS.Mechanics/Beginner/main.ss.Open in SS Lab
Documentation version

Language 1.0.0, compiler 1.0.0, runtime 1.0.0. This reference is generated from the official SS documentation so package and language details stay consistent with the release.