Hello,
I want to make a JSON file with results of my code (represented as follows through a simple function testFunct). I tried to make a struct list but I’m not sure if this is the correct apporach. Can someone help? Thank you…
package main
import (
"fmt"
)
func main() {
type allResults struct {
length, result int
}
out := []allResults {}
for i := 0; i < 10; i++ {
n := allResults{length: i, result: testFunct(i)}
out = append(out,n)
}
fmt.Println(out)
}
func testFunct(length int) int{
return length*10
}