Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Playground: Trying to disable output for specific lines of code

I have a very long loop that takes forever in playground because of the constant output. Is there a way to disable output for certain lines of code? I still want the whole thing to run, I just don't want to wait forever to see the result.

FYI - I know I can run the code on demand but that doesn't matter . It still takes forever. I don't mind it running continuously, I just want it to run without all of the output.

FYI - I also know that playground is not used for performance. I just don't want to wait forever to see a result. I'm not testing performance.

like image 471
Anat Gotfried Kramer Avatar asked Nov 21 '22 01:11

Anat Gotfried Kramer


1 Answers

This question was answered in this post.

To summarize the portion relevant to your question: wrapping your code in a tuple will prevent it from having output in Xcode Playgrounds and speed up execution time.

For example:

input: var x = 10 // output: 10
input: (var x = 10) // output: None
like image 101
rikitikitavi Avatar answered Dec 09 '22 10:12

rikitikitavi