Return the index of the added element

This commit is contained in:
2024-10-20 12:57:24 +02:00
parent 764b143ff8
commit 8ce7d54d00
7 changed files with 65 additions and 59 deletions

View File

@@ -21,9 +21,9 @@ func NewPerson(name string) *Person {
}
}
// AddExtension adds the Extension to the Person.
func (p *Person) AddExtension(e *ExtensionElement) {
addToSlice(&p.Extensions, e)
// AddExtension adds the Extension to the Person. It returns an int.
func (p *Person) AddExtension(e *ExtensionElement) int {
return addToSlice(&p.Extensions, e)
}
// DeleteExtension deletes the Extension at index from the Person. It return an