jebmarcus jebmarcus - 1 year ago 118
iOS Question

Swift function does not print

Any idea why this simple piece of code is not printing anything? It should print "A shape with 5 sides"

class shape {

func sides (num: Int) -> String {
return "A shape with \(num) sides"

func printResult () {




Answer Source

If you call it it works



enter image description here

By the way the name of a class should start with an uppercase char so Shape instead of shape.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download