Compile then run. You write AssemblyScript; the playground emits WASM.
Goal
Log 1 to prove the module ran.
@external("env", "log")
declare function log(n: i32): void;
@external("env", "logStr")
declare function logStr(s: string): void;
export function main(): void {
log(1);
}@external("env", "log")
declare function log(n: i32): void;
@external("env", "logStr")
declare function logStr(s: string): void;
export function main(): void {
logStr("compiled then ran");
}@external("env", "log")
declare function log(n: i32): void;
@external("env", "logStr")
declare function logStr(s: string): void;
export function add(a: i32, b: i32): i32 {
return a + b;
}
export function main(): void {
log(add(2, 3));
}@external("env", "log")
declare function log(n: i32): void;
@external("env", "logStr")
declare function logStr(s: string): void;
export function main(): void {
log(12);
}