Xcode Playground Does Not Perform Functions

I created a new playground and I add a simple function, but the function was never called:

var str = "New playground" func hello() { print("Hello, World") } 

enter image description here

Do any of you know why the function was not called?

I will be very grateful for your help.

+6
source share
1 answer

Because you did not call the function. Just call it:

 func hello() { print("Hello, World") } hello() 
+14
source

All Articles