65 lines
1.4 KiB
C#
65 lines
1.4 KiB
C#
void sep(){
|
|
Console.WriteLine("+-----+");
|
|
}
|
|
|
|
Console.WriteLine("a" == "a");
|
|
Console.WriteLine("a" == "A");
|
|
Console.WriteLine(1 == 2);
|
|
sep();
|
|
|
|
string myValue = "a";
|
|
Console.WriteLine(myValue == "a");
|
|
sep();
|
|
|
|
Console.WriteLine("a" == "a ");
|
|
sep();
|
|
|
|
string value1 = " a";
|
|
string value2 = "A ";
|
|
Console.WriteLine(value1.Trim().ToLower() == value2.Trim().ToLower());
|
|
sep();
|
|
|
|
Console.WriteLine("a" != "a");
|
|
Console.WriteLine("a" != "A");
|
|
Console.WriteLine(1 != 2);
|
|
|
|
myValue = "a";
|
|
Console.WriteLine(myValue != "a");
|
|
sep();
|
|
|
|
Console.WriteLine(1 > 2);
|
|
Console.WriteLine(1 < 2);
|
|
Console.WriteLine(1 >= 1);
|
|
Console.WriteLine(1 <= 1);
|
|
sep();
|
|
|
|
string pangram = "The quick brown fox jumps over the lazy dog.";
|
|
Console.WriteLine(pangram.Contains("fox"));
|
|
Console.WriteLine(pangram.Contains("cow"));
|
|
sep();
|
|
|
|
// These two lines of code will create the same output
|
|
|
|
Console.WriteLine(pangram.Contains("fox") == false);
|
|
Console.WriteLine(!pangram.Contains("fox"));
|
|
sep();
|
|
|
|
Console.WriteLine(!pangram.Contains("fox"));
|
|
Console.WriteLine(!pangram.Contains("cow"));
|
|
sep();
|
|
|
|
int a = 7;
|
|
int b = 6;
|
|
Console.WriteLine(a != b); // output: True
|
|
string s1 = "Hello";
|
|
string s2 = "Hello";
|
|
Console.WriteLine(s1 != s2); // output: False
|
|
sep();
|
|
|
|
int saleAmount = 1001;
|
|
Console.WriteLine($"Discount: {(saleAmount > 1000 ? 100 : 50)}");
|
|
|
|
saleAmount = 1;
|
|
Console.WriteLine($"Discount: {(saleAmount > 1000 ? 100 : 50)}");
|
|
sep();
|