char ch = Convert.ToChar ('a' | 'b' | 'c'); switch (ch) { case 'A': case 'a': Console.WriteLine ("case A | case a"); break; case 'B': case 'b': Console.WriteLine ("case B | case b"); break; case 'C': case 'c': case 'D': case 'd': Console.WriteLine ("case D | case d"); break; }
int i = 2, j = i; if (Convert.ToBoolean((i | j & 5) & (j - 25 * 1))) Console.WriteLine(1); else Console.WriteLine(0);
if (age > 18 && no < 11) a = 25;
int i; for(i = 0; i<=10; i++) { if(i == 4) { Console.Write(i + " "); continue; } else if (i != 4) Console.Write(i + " "); else break; }
int val; for (val = -5; val <= 5; val++) { switch (val) { case 0: Console.Write ("India"); break; } if (val > 0) Console.Write ("B"); else if (val < 0) Console.Write ("X"); }
int i, j, id = 0; switch (id) { case i: Console.WriteLine("I am in Case i"); break; case j: Console.WriteLine("I am in Case j"); break; }
switch (id) { case 6: grp = "Grp B"; break; case 13: grp = "Grp D"; break; case 1: grp = "Grp A"; break; case ls > 20: grp = "Grp E"; break ; case Else: grp = "Grp F"; break; }
namespace CuriousTabConsoleApplication { public enum color { red, green, blue }; class SampleProgram { static void Main (string[ ] args) { color c = color.blue; switch (c) { case color.red: Console.WriteLine(color.red); break; case color.green: Console.WriteLine(color.green); break; case color.blue: Console.WriteLine(color.blue); break; } } } }
int a = 1, b = 2, c = 0; if (a < b) c = a;
int a = 1, b = 2, c = 0;
c = a < b ? a : 0;
int a = 1, b = 2, c = 0;
a < b ? c = a : c = 0;
int a = 1, b = 2, c = 0;
a < b ? c = a : c = 0 ? 0 : 0;
int a = 1, b = 2, c = 0;
a < b ? return (c): return (0);
int a = 1, b = 2,c = 0;
c = a < b : a ? 0;
int a = 1, b = 2, c = 0;
c = a < b ? a : 0;
int i = 0; do { Console.WriteLine(i); i+ = 1; } while (i <= 10);
int i = 0;
do
{
Console.WriteLine(i);
} until (i <= 10);
int i;
for (i = 0; i <= 10 ; i++)
Console.WriteLine(i);
int i = 0;
while (i <= 11)
{
Console.WriteLine(i);
i += 1;
}
int i = 0;
do while ( i <= 10)
{
Console.WriteLine(i);
i += 1;
}
int i = 0;
do until (i <= 10)
{
Console.WriteLine(i);
i+=1;
}
int i;
for (i = 0; i <= 10 ; i++)
Console.WriteLine(i);
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.