Bird
0
0

What is the default behavior of the print function in Swift?

easy📝 Conceptual Q1 of 15
Swift - Basics and Runtime

What is the default behavior of the print function in Swift?

AIt returns a string without printing anything
BIt outputs text to the console with a newline at the end
CIt saves the text to a file
DIt pauses the program execution
Step-by-Step Solution
Solution:
  1. Step 1: Understand the print function's purpose

    The print function is used to show output on the console or terminal.
  2. Step 2: Identify default behavior

    By default, print adds a newline after the text so the next output starts on a new line.
  3. Final Answer:

    It outputs text to the console with a newline at the end -> Option B
  4. Quick Check:

    print default behavior = outputs with newline [OK]
Quick Trick: print adds a newline automatically unless changed [OK]
Common Mistakes:
  • Thinking print returns a string
  • Assuming print writes to a file
  • Believing print pauses execution

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes