Use if and 'if else' statement with string and boolean type value (C#) : if « Language Basics « ASP.NET Tutorial






<%@ Page Language="C#" %>

<script runat="server">
   void Page_Load(Object Sender, EventArgs e) {
      string MyMessage = "Hello";
      bool MyBool = true;
   
      if (MyMessage == "Hi" & MyBool) {
         Response.Write(MyMessage);
      } else if (MyMessage == "Hello") {
         Response.Write("True");
      } else {
         Response.Write("False");
      }

      if (!MyBool) {
         Response.Write("False");
      }   
   }
</script>

<html><body>

</body></html>








2.5.if
2.5.1.Use if statement with string type value (VB)
2.5.2.Use if statement with boolean type value (VB)
2.5.3.Use if and 'if else' statement with string and boolean type value (C#)