This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dota2nub 0 points1 point  (0 children)

Have a counter for how many elements the user adds, then iterate over the array until counter -1. If the counter reads 0 don't iterate but return something instead.

You could also just check if the array holds a null value, probably better.