Skip to content

Instantly share code, notes, and snippets.

@codecademydev

codecademydev/Index.cshtml Secret

Created Jul 30, 2020
Embed
What would you like to do?
Codecademy export
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
string grade = "A";
}
<div class="text-center">
<h1 class="display-5">Let's work with conditionals!</h1>
<hr>
<h3>Exam results:</h3>
<br>
@switch (grade)
{
case "A": <h4>Excellent job!</h4>
break;
case "B": <h4>Well done!</h4>
break;
case "C": <h4>Needs some work!</h4>
break;
case "D": <h4>You Passed</h4>
break;
case "F": <h4>You failed, better try next time</h4>
break;
default: <h4>Invalid Grade!</h4>
break;
};
<h4>Your grade is, @grade</h4>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment