Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHesham Alassaf
1,023 PointsA had a problem with log.i() method
The Challenge want me to put the title and the pages in the log but i tried every thing but i can't solve it !!
2 Answers
Hesham Alassaf
1,023 PointsThe codes I wrote it is : Log.i("CodeChallenge", title + i + "," + pages); Log.i("CodeChallenge", title + "," + pages); Log.i("CodeChallenge", title, pages); Log.i("CodeChallenge", title + pages);
It must be like this (Ex. output: 'Book title 1, 300'.)
Gunjeet Hattar
14,483 PointsI faced some problem too when I started out on this challenge.
What it wants you to do is be exact with the syntax. The syntax demands you to print in the format
"Then use the 'Log.i()' method (with "CodeChallenge" as the tag) to write the book title, a comma, a space, and the number of pages"
So we have the title + ", " + pages
Remember to add space after the comma also there is no need to print the index number i since it is not asked for.
Hope that helps.
Log.i("CodeChallenge", title + ", " + pages);