I'm new at C# Programming, I just wanna ask if is it possible to change if, else statement syntax in C#?
Example:
Instead of :
a=5;
b=6;
if (a<b)
{
Console.WriteLine("Big");
}
else
{
Console.WriteLine("Small");
}//Output is Small
I would like to change if else statement syntax to other words:
a=5;
b=6;
**say** (a<b)// say is "if"
{
Console.WriteLine("Big");
}
**but**// but is "else"
{
Console.WriteLine("Small");
}//Output is Small
I wanna type it in the textbox and display it in the label How to do this?
I'm hoping for your help, thank you.
No, you can't change the syntax of C#. It's baked into the language.
Of course, you could check out the Roslyn compiler and build your own "not quite C#" compiler... but I'd strongly advise against it. Why would you want to create a language which no-one but yourself knows how to use, and which has no real advantages over C# other than using a very slightly different vocabulary? You wouldn't be adding anything to the expressive power of the language by doing so.
See more on this question at Stackoverflow