a unit's position is described using three numbers : west/east, north/south, and height. another way of writing this is [x,y,z], which is what a positional array looks like.
to get a unit's positional array you use the getpos command.
to get at the values in an array you use the select command. arrays begin at 0 for the first value, 1 for the next value, and so on.
getpos unit select 0 would give its west/east or x coordinate.
getpos unit select 1 would give its north/south or y coordinate.
getpos unit select 2 would give its height or z coordinate.
what is difficult about that?