← Back to reading
Lab

Compile time and runtime

Report a problem in this lab

For typos, mistakes and things that don’t work. We read every report and fix what’s wrong, but we don’t reply here, so a question won’t get an answer.

F-PHASE-V4-1easy · review

Review the four-unit carton

The station adds a carton with two layers of two units. Review the fixed template initializer and two orders before connecting its calculated unit count to ordinary dispatch.

What needs to change

Use the supplied candidate with separate inputs 0 and 3. Record whether the template declaration is permitted, predict both calculated unit counts and classify them against the dispatch limit of 0 through 6 units.

Reproduce

  1. Read the candidate in main.ts with separate inputs 0 and 3. Review const perBox and the calculated unit counts.

Acceptance criteria

  • Declaration outcome
  • Two orders
  • Dispatch eligibility

Notes

The carton contains two layers of two units. The ordinary dispatch limit is 0 through 6 units; the calculator itself only computes units.

Use the supplied TypeScript source and Node command. Input parsing and the carton calculation are included.

These are source-based predictions for a supplied complete program. No native execution receipt is supplied for this new candidate.

Read only

Sign in with access to this level to check your decisions. You can still inspect the supplied evidence.

Sign in →
main.ts
import { readFileSync } from "node:fs";

function readCount(): number {
    return Number(readFileSync(0, "utf8").trim());
}

const perBox = 2 * 2;

const count = readCount();

console.log(count * perBox);
Native command
npx tsc main.ts --noEmit --skipLibCheck --target es2022 --module nodenext --types node && node main.ts
Not checked