Reputation: 6177
I am writing a Swift coding test for new iOS candidates that interview at my company, I have decided to utilise Swift playgrounds so that I can include some hands on coding questions.
Some questions will include example code, so I would not like this code to produce anything in the output window. I'd rather not just comment it out as I'd like to utilise the syntax highlighting etc...
Is there any kind of annotation or equivalent I can add to the code in question to prevent it showing in the output window?
Many Thanks.
Upvotes: 0
Views: 692
Reputation: 4377
As far as I know there is no annotation to suppress the execution of code in a playground. If you want to keep the syntax highlighting but don't want the code to be executed/produce any output I suggest you just wrap it in a function. That way you have full autocomplete and syntax highlighting support but it does not produce any output in the playground.
func example() {
print("No output")
}
Other than that you can just use the Example callout Markup. This allows you to format code using markup but without syntax highlighting.
Hope that helps.
Upvotes: 1