Back to questions
JuniorTheoryCommon
What happens when this program is compiled and run?
print("start")
prnt("middle")
print("end")It does not compile
- Expecting
startand then an error: Swift compiles the whole file before running it, so the typo on line 2 stops the build and line 1 never runs. - Expecting the bad line to be skipped: an unknown name is a compile error, not a warning, so no program is created and nothing is printed.
- What would the program print if line 2 held only the text
"middle", withoutprint? - Where in the compiler's message do you find the number of the line with the error?