Check Even Number - Assemblyscript Typing CST Test
Loading…
Check Even Number — Assemblyscript Code
Returns true if a number is even.
# assemblyscript/demo/isEven.ts
export function isEven(n: i32): bool {
return (n % 2) == 0;
}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.