Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Get the length of a slice from a multi-dimensional array
Post
Get the length of a slice from a multi-dimensional array
+4
−0
If I have a one-dimensional array, I can get the length of it quite easily:
var x = moves.Length()
.
However, if the array is multi-dimensional, .Length()
returns the total number of elements. If moves is defined as int[4,2]
, the moves.Length()
returns 8.
Is there a way that I can specify either the X or Y and get the number of elements for that slice?
1 comment thread