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; } } } }
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; }
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; }
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 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);
if (Condition1)
{// Some statement}
if (Condition1) {// Some statement}
else {// Some statement}
if (Condition1) {// Some statement}
else {// Some statement}
else if ( Condition2){//Some statement}
if ( Condition1 ) {// Some statement}
else if ( Condition2 ) {// Some statement}
else {// Some statement}
if ( Condition1 ) {// Some statement}
else if ( Condition2 ) {// Some statement}
else if ( Condition3 ) {// Some statement}
else {// Some statement}
if (Condition1) {// Some statement}
else {// Some statement}
else if ( Condition2){//Some statement}
int i = 20 ; for( ; ; ) { Console.Write(i + " "); if (i >= -10) i -= 4; else break; }
char[ ] arr = new char[ ] {'k', 'i','C', 'i','t'} ;
do
{
Console.WriteLine((char) i);
}
while (int i = 0; i < arr; i++);
foreach (int i in arr)
{
Console.WriteLine((char) i);
}
for (int i = 0; i < arr; i++)
{
Console.WriteLine((char) i);
}
while (int i = 0; i < arr; i++)
{
Console.WriteLine((char) i);
}
do
{
Console.WriteLine((char) i);
}
until (int i = 0; i < arr; i++);
foreach (int i in arr)
{
Console.WriteLine((char) i);
}
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.