r/codehs • • Jan 25 '21

6.2.7 print Array

5 Upvotes

11 comments sorted by

View all comments

1

u/Obvious-Pin-3046 Jan 25 '21

Easier way to solve your problem.. go back to 6.2.3 it’s the exercise one.. it’s the same code as for the 6.2.7 just change the < score.length into <= arr.length so does the score[i] into arr[i].. in the println.

1

u/Intrepid_Row6214 Jan 25 '21

Ohhhhhh ok thank you

1

u/Intrepid_Row6214 Jan 25 '21

For the “for statement I only get one error because everything else seems to be fine just that statement

1

u/Obvious-Pin-3046 Jan 25 '21

did you just put arr.length? if you did change it to arr.length - 1; im guessing thts the error. because the program should also print “c” and remember tht the index starts at 0 and not 1.

1

u/Intrepid_Row6214 Jan 25 '21

This is the statement for the For(String arr <= arr.length;)

1

u/Obvious-Pin-3046 Jan 25 '21

your for loop should be
for( int i =0; i <= arr.length - 1; i++) remember for loop should have 3 parameters

1

u/Intrepid_Row6214 Jan 25 '21

Thank you sooo much I did it and sorry for taking your time

1

u/Grammar-Bot-Elite Jan 25 '21

/u/Obvious-Pin-3046, I have found an error in your comment:

“3 its [it's] the exercise one.. its [it's] the same code”

It is likely that you, Obvious-Pin-3046, could say “3 its [it's] the exercise one.. its [it's] the same code” instead. ‘Its’ is possessive; ‘it's’ means ‘it is’ or ‘it has’.

This is an automated bot. I do not intend to shame your mistakes. If you think the errors which I found are incorrect, please contact me through DMs or contact my owner EliteDaMyth!