You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A common operation is to access the last element of a slice. When the slice is not in a variable this can be cumbersome because of the need to repeat the argument.
We propose to add the Last function to the slices package.
package slices
// Last returns the last element of a non-empty slice.funcLast[S~[]E, Eany](sliceS) E {
returnslice[len(slice)-1]
}
The text was updated successfully, but these errors were encountered:
A common operation is to access the last element of a slice. When the slice is not in a variable this can be cumbersome because of the need to repeat the argument.
We propose to add the
Last
function to theslices
package.The text was updated successfully, but these errors were encountered: