if (condition)
{
//Block of C statements here
//These statements will only execute if the condition is true
}if (<condition>) {
<code>
} else if (<condition>) {
<code>
} else {
<code>
}
/* example */
int money = 50;
if (money < 15) {
go_home();
} else if (money >= 600) {
buy_all();
} else {
buy_tickets(money / 15);
}
/* You can chain together as many else ifs as you want. But if there are
too many it will make the code hard to understand. In that case I would
recommend trying other solutions. */#include <studio.h>
int main()
{
if (logic goes here)
{
CODE
}
else if (logic)
{
CODE
}
else{
CODE
}
return 0
}char o = '+'; //Or some other character
if (o == '%' || o == '/' || o == '*' || o == '+' || o == '-') {
//Do something
//...
}if(number > 10)
Console.WriteLine("test1");
else
if(number < 0)
Console.WriteLine("test2");