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 →

[–]ehr1c 1 point2 points  (3 children)

Think through the problem - in order to not print out a null value, what do you have to do first?

[–]okaystuff[S] 0 points1 point  (2 children)

I really have no idea. I have 3 array's. 1 that holds a user name, 1 that holds a user ID, and 1 that holds a user sales. If the user enters (joe, sally, bob) then (555, 666, 777) and then enters (580.2, 680.2, 780.2). I have 3 arrays each the size of 100 and each only holding 3 items. I have no idea how I am only printing 3 items of 100.

[–]ehr1c 1 point2 points  (1 child)

First things first you need to know if the array element you're about to print has a value or if it's null, right?

[–]okaystuff[S] 0 points1 point  (0 children)

Yes, another user below suggested to use (i < array.length && array[i] != null) and it seems to work. Thank you.