Relative Content

Tag Archive for goslice

Taking a slice pointer and returning pointers to that slice’s elements

Im currently learning GO and i decided to redo a character ranker i made in python a year ago as an exercise. The program takes user input and makes a slice of structs with them (the struct consists of a name inputted and a score of 0), then a function creates matches between the inputed characters so the user can choose between the two in pair.
full code here

Taking a slice pointer and returning pointers to that slice’s elements

Im currently learning GO and i decided to redo a character ranker i made in python a year ago as an exercise. The program takes user input and makes a slice of structs with them (the struct consists of a name inputted and a score of 0), then a function creates matches between the inputed characters so the user can choose between the two in pair.
full code here

Trying to better understand the behavior of slices

When I read over slices in Go they seemed reasonable enough.
I understand that the slice structure has a capacity based on the underlying array and a length of the currently contained elements, also that the slice references the array underneath.