Showing posts with label If and Else Conditions. Show all posts
Showing posts with label If and Else Conditions. Show all posts

Thursday, November 6, 2014

If and Else Conditions



If and Else Conditions
An important feature of dynamic web pages is that you can determine what to do based on conditions.
The common way to do this is with the if ... else statements:
Example
@{
var txt = "";
if(DateTime.Now.Hour > 12)
  {txt = "Good Evening";}
else
  {txt = "Good Morning";}
}
<html>
<body>
<p>The message is @txt</p>
</body>
</html>