LESSON 02 OF 52 · CHAPTER 01

Bindings

bind defines immutable values and expressions

ORIGINAL SOURCE

02-bindings.srp

// Bindings are visible after their declaration.
bind width = 6;
bind height = 7;
bind area = width * height;
print("Area:");
print(area);
EXPECTED OUTPUT

stdout

Verified
Area:
42

UNDERSTAND THE CODE

Explanation & practice

What this example teaches

bind defines immutable values and expressions

Expected behavior

Area followed by 42

Practice: Read the source before looking at the output. Predict the values and their order, then use the pinned compiler to execute this lesson and compare the exact fixture. Identify which operation produces the result.

अपरिवर्तनीय बाइंडिंग

bind किसी नाम से एक मान जोड़ता है। उदाहरण में चौड़ाई और ऊँचाई से क्षेत्रफल निकाला गया है। bind को बाद में पुनः असाइन नहीं किया जा सकता।

अभ्यास: width और height से निकले परिणाम का अनुमान लगाइए।

Explanations are sourced from the project's English chapter guide and हिन्दी अध्याय. The Scarp program and output are unchanged.

SOURCE-BACKED SELF-CHECK · स्रोत-आधारित अभ्यास

Quick checkpoint / त्वरित अभ्यास

What number is printed for area after width = 6 and height = 7?width = 6 और height = 7 होने पर area के लिए कौन-सी संख्या प्रिंट होती है?

Reveal the source-backed answer / सही उत्तर देखें

42 — The binding area multiplies width by height: 6 × 7 = 42. The verified output prints 42 after the Area label.42 — area में width × height की गणना होती है: 6 × 7 = 42। सत्यापित आउटपुट में Area के बाद 42 प्रिंट होता है.

This question checks understanding of a recorded compiler output. It does not run Scarp in the browser. यह प्रश्न सत्यापित आउटपुट पर आधारित है; ब्राउज़र में Scarp नहीं चलता।

TRY IT LOCALLY

Verify, then execute

Use the pinned compiler from the course root. Keep any imported _support files next to the source.

scarp verify examples/01-basics/02-bindings.srp scarp exec examples/01-basics/02-bindings.srp

The website does not run code. Read the CLI guide ↗

Pinned compiler: Scarp v0.0.6-alpha.3 · ceff07d9014f. No simulated output.