1

we can return a string like below :

 var dogName : String {
        return "my dog name"
    }

as well as below :

func returndogName() -> String {
        return "my dog name"
    }

basically these two does the same. it returns a string. the only I got is the second one is a function type and first one is not. is that the only difference or are there any other differences with this. and are there any advantages between these two. that means which is the best.

Martin R
  • 488,667
  • 78
  • 1,132
  • 1,248
Marlon Brando aka Ben
  • 767
  • 1
  • 12
  • 25

0 Answers0