Minimum of Two Numbers - Assemblyscript Typing CST Test
Loading…
Minimum of Two Numbers — Assemblyscript Code
Returns the minimum of two integers.
# assemblyscript/demo/min.ts
export function min(a: i32, b: i32): i32 {
return a < b ? a : b;
}Assemblyscript Language Guide
AssemblyScript is a TypeScript-like language that compiles to WebAssembly (Wasm). It allows developers familiar with TypeScript/JavaScript to write high-performance WebAssembly modules for web, server, and blockchain applications.
Primary Use Cases
- ▸High-performance web modules
- ▸Blockchain smart contracts (e.g., NEAR Protocol, Polkadot parachains)
- ▸Game engines or physics simulations in the browser
- ▸Data processing in the browser or edge environments
- ▸Embedding Wasm modules in Node.js or serverless platforms
Notable Features
- ▸TypeScript-like syntax with optional static typing
- ▸Direct compilation to WebAssembly
- ▸Small and efficient Wasm output
- ▸Supports import/export with JavaScript
- ▸Active open-source ecosystem and tooling
Origin & Creator
AssemblyScript is an open-source project maintained by the AssemblyScript community, started around 2017.
Industrial Note
AssemblyScript is ideal for web developers seeking performance-critical modules, blockchain developers building smart contracts on Wasm chains, and projects that need a bridge between TypeScript and WebAssembly.