I am trying to use an array in Go but I cannot find anything that works with both integers and strings in the same array. I am looking for some documentation that would help me with this problem.
I have it working in Python and I am trying to translate it into Go. Most of the information I found online is showing either arrays of integers or arrays of strings but not both combined.
The integer & string will be passed into another function, depending on the value of the integer determines which string will be concatenated to the string value of the array.
This is an example from Python:
# This is the set arrays
List = [[1, "Pie"], [10, "Fish"], [5, "apples"]]
#This is the code of the function that each array will be passed into
if list[0] == 1:
return "There is one " + list[1] + "."
else:
return "There are " + str(list[0]) + " " + list[1] + "."
Final Print Output:
There is one Pie.
There are 10 Fish.
There are 5 apples.