combineAsArray: inline checkEnd function