A

Admin • 670.22K Points
Coach

Q. Which of the following is a correct way to declare a computed read-only property?

  • (A) var square = side * side
  • (B) var square: Int { return side * side }
  • (C) let square = side * side
  • (D) var square() -> Int
  • Correct Answer - Option(B)
  • Views: 1
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin
This is the correct syntax for a computed property in Swift.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.