Golang - How to get the last element of a slice? Code Example

Here is the solution for "How to get the last element of a slice?" in Golang.

Golang code for How to get the last element of a slice?

sl[len(sl)-1]
/*sl - is slice*/
Code by IncludeHelp, on March 4, 2023 23:39

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.