LESSON 13 OF 52 · CHAPTER 01

Comments

// line comments, strings containing comment markers and whitespace between tokens

ORIGINAL SOURCE

13-comments.srp

// Comments and whitespace may separate tokens.
println // statement name
(
    "// inside a string is text"
)
;
print(""); // An empty string still writes a newline.
print("done");
EXPECTED OUTPUT

stdout

Verified
// inside a string is text

done

UNDERSTAND THE CODE

Explanation & practice

What this example teaches

// line comments, strings containing comment markers and whitespace between tokens

Expected behavior

// inside a string is text, blank line, then done

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.

टिप्पणियाँ और खाली स्थान

// एक लाइन की टिप्पणी आरम्भ करता है, लेकिन उद्धरण के भीतर "// inside a string is text" साधारण टेक्स्ट है। इस उदाहरण में println और अगले ( के बीच टिप्पणी व नई लाइन है; पिन किए गए कम्पाइलर में यह मान्य है। खाली स्ट्रिंग का print एक खाली आउटपुट लाइन बनाता है।

आउटपुट: पहले // inside a string is text, फिर खाली लाइन, फिर done।

अभ्यास: फ़ाइल में किस // से टिप्पणी शुरू होती है, और कौन-सा // स्ट्रिंग का हिस्सा है?

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

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/13-comments.srp scarp exec examples/01-basics/13-comments.srp

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

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