GUIDED LAB 05 OF 06 · VERIFIED SCARP
Use a public module binding
मॉड्यूल की public binding इस्तेमाल करें
The challenge · अभ्यास
Import the included helper module and print twice its public value, obtaining 42. Do not edit the helper file.
दिए गए helper मॉड्यूल को import करके उसके public मान का दोगुना प्रिंट करें, ताकि 42 मिले। helper फ़ाइल न बदलें।
starter.srp
// Lab: transform the imported value into the desired output.
import "_support/values.srp" as values;
print(values.value);
solution.stdout
42
Run and check your attempt locally
Copy starter.srp to attempt.srp in the same lab folder,
edit it, and use the pinned Scarp compiler from the repository root.
Keeping the same folder is important for imports and the bundled _support helper.
scarp verify labs/05-modules/attempt.srp
scarp exec labs/05-modules/attempt.srpCompare the printed output with the fixture shown above. No website execution, uploads or stored answers are involved.
Show hint · संकेत देखें
The import already works. Apply multiplication to values.value in the print call.
import पहले से सही है। print में values.value को 2 से गुणा करें।
Reveal tested solution · सत्यापित हल देखें
// Import one public value from a local helper module and double it.
import "_support/values.srp" as values;
print(values.value * 2);
The helper exports value = 21; the importer prints 21 × 2 = 42.
helper से value = 21 export होता है; import करने वाला प्रोग्राम 21 × 2 = 42 प्रिंट करता है।
Reference .srp on GitHub ↗The starter compiles but intentionally does not produce the goal. The reference solution and its output are verified on Linux, macOS and Windows against Scarp v0.0.6-alpha.3. Browse all labs ↗