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 trialDenis C
227 PointsFIX YOUR QUIZ SECTION!!!!!!!!!!!!
I mean look at this example.. its exactly as the example from the video tutorial(just with different namings).. in the tutorial <li>@artists</li> displays the text from the array no problem, here it doesnt and no explanation why.. If you gonna make a quiz especially for a beginner level throw some explanation why its not working. Im doing everything it says in the tutorials and here in the quiz it just doesnt displays what it should.. This quiz sections need some work, it`s just getting frustrating and time consuming when a beginner its trying to do what he was taught in the videos and here in the quiz I get stupid errors like tadaaaam "did you put the <li> withing the foreach loop??" - YES its right there!! explain in more details why its not working. Im considering giving up Treehouse, your quiz sections are poorly designed , with unrelated errors and no explanation. Why some code will work in the video tutorial and not here its beyond me.
@{
Layout = null;
var title = "Super Mario 64";
var description = "Super Mario 64 is a 1996 platform video game developed and published by Nintendo for the Nintendo 64.";
var characters = new string[]
{
"Mario",
"Princess Peach",
"Bowser",
"Toad",
"Yoshi"
};
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Video Game Detail</title>
</head>
<body>
<div>
<h1>@title</h1>
<h5>Description:</h5>
<div>@description</div>
<h5>Characters:</h5>
<div>
<ul>
@foreach (var character in characters)
{
<li>@characters </li>
}
</ul>
</div>
</div>
</body>
</html>
1 Answer
Allan Clark
10,810 PointsThe quiz is fine, I understand your frustration. We all got frustrated starting out, heck you'll always get frustrated with it, just sometimes need to step away clear your head and come back to it. When you are out in the wild you wont get errors that say exactly what the issue is.....you might not get errors at all, its all about trial and error and when need be seek help like you are with this post. :)
As for the issue, just change this line:
<li>@characters </li>//this needs to be 'character'
the foreach loop will create what you have in the brackets for each in the list of characters, so using the character variable tells Razor where to put it.
Keep it up man and don't get discouraged man. think of it as a puzzle to solve and don't hesitate to put a post on the forum when you get stuck, thats what its there for. :)
Happy Coding!
Denis C
227 PointsDenis C
227 PointsOH MY GOD!! ... one letter! ..I checked everywhere but didnt look carefully inside the foreach loop.. Thank you! One thing for sure is I`ll never forget this now. I cant believe such a simple mistake completely discouraged me and drove me nuts. Thank you for enlightening this example for me, I can finally move on in peace.