LESSON 08 OF 52 · CHAPTER 01
Output
write versus print
08-output.srp
// Output without a final newline.
bind name = "Scarp";
write("Hello, ");
print(name, 3, true,);
print();
write("done");
stdout
Hello, Scarp 3 true
doneWrite what you expect this program to print. Check prediction for a line-level hint without revealing the answer, or reveal the verified output when ready. This checks displayed text only; it does not run Scarp or save your input.
UNDERSTAND THE CODE
Explanation & practice
What this example teaches
write versus print
Expected behavior
Mixed output; final done has no newline
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.
print और write
print नई पंक्ति जोड़ता है, जबकि write स्वयं नई पंक्ति नहीं जोड़ता। अंतिम done के बाद इस उदाहरण में नई पंक्ति नहीं है।
अभ्यास: खाली print() आउटपुट में क्या बदलाव लाता है?
Explanations are sourced from the project's English chapter guide and हिन्दी अध्याय. The Scarp program and output are unchanged.
LEARNING PROGRESS
Keep your place
Mark this lesson complete when you are ready.
Only saved in this browser. No account or tracking.
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/08-output.srp
scarp exec examples/01-basics/08-output.srpThe website does not run code. Read the CLI guide ↗
Pinned compiler: Scarp v0.0.6-alpha.3
· ceff07d9014f. No simulated output.