0

I have the function Strength():

func (g Group) Strength() (Name []Entity, err error)

I am trying to call this function and store the values in some variable like below:

for _,x := range f.Strength() {
        ...
    }

But this is giving error:

multiple-value f.strength in single-value context

Pika Supports Ukraine
  • 3,612
  • 10
  • 26
  • 42

1 Answers1

0

Strength() returns a slice and error. Try this.

strengths,err := f.Strength()
if err != nil{
   // Handler err
}

for _,x := range strengths{
  ...
}