Problem with a 'setter' on a 'struct'

The following code does not work. Although it is correctly compiled, there is a runtime error on the “self.age = newAge” statement and I don’t know why.
It takes a relatively long time before crasching with a lot of messages “Person.age.setter” in the left panel (more than 260 000 !). Then the program ended with exit code: 9

// Person.swift
struct Person {

var name = "Ruben"
var age : Int  {

    get { return self.age  }
    set(newAge) { self.age = newAge  }


// Main.swift
var myPerson = Person()
myPerson.age = 24

You can’t return the computed property self in its getter. You tipically return a computed value derived from a (private) stored prop

Ah yes, ok ! Thanks !

you’re welcome :slight_smile: