LESSON 12 OF 52 · CHAPTER 01

Escapes

Newline, quotation mark, and backslash escapes

ORIGINAL SOURCE

12-escapes.srp

print("line one\nline two");
print("a quote: \"Scarp\"");
print("a backslash: \\");
EXPECTED OUTPUT

stdout

Verified
line one
line two
a quote: "Scarp"
a backslash: \

UNDERSTAND THE CODE

Explanation & practice

What this example teaches

Newline, quotation mark, and backslash escapes

Expected behavior

Four visible output lines

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.

स्ट्रिंग एस्केप

स्ट्रिंग में newline, उद्धरण चिह्न और बैकस्लैश दिखाने के लिए विशेष escape sequences हैं।

अभ्यास: तीन print कथन कई आउटपुट पंक्तियाँ क्यों दे सकते हैं?

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

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

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