SP Language Syntax Tour
SP combines the best parts of C-family ergonomics with modern type safety. Explore the core syntax chapters below:
tour_preview.sp
1import std.io;23// Variables with inference4let name = "SP";5var counter = 0;67// Type annotations & functions8fn add(int a, int b) -> int {9 return a + b;10}1112// Pattern matching13enum Role { Admin, User }1415fn check(Role r) -> string {16 return match (r) {17 Role.Admin => "Superuser",18 Role.User => "Standard"19 };20}
⭐ New: All 100 Code Examples
Complete SP Syntax Guide (1–100 Examples)
Browse, search, and copy all 100 serial code examples from basic syntax to multi-threaded REST microservices.
Variables & Constants
let and var declarations, mutability, and type inference.
Primitive & Complex Types
int, double, string, bool, and collection structures.
Control Flow & Matching
if/else, for loops, while loops, and pattern matching.
Functions & Closures
Named functions, return types, and default parameters.
OOP, Classes & Structs
Constructors, inheritance, interfaces, and value structs.
Zero-Cost Generics
Generic types with compile-time monomorphization.
Lambdas & Functional Pipelines
Arrow lambdas, closures, map/filter/reduce.
Null Safety & Operators
Nullable types (T?), safe navigation (?.), and coalescing (??).