This topic is locked

Multiple colors

6/16/2019 10:55:46 AM
ASPRunner.NET General questions
O
Onofre author

I need to put one more condition in the code below:
If the value is greater than 0 black

If the value is less than 0 red

If the value is the same - green color
string color;

if (value> 0) {color = "black";}

else

{color = "red";}

value = "+ color" "+ value.ToString () +" </ span> ";
Can you help me?

Thank you

admin 6/16/2019

C# languages reference will be a good start:

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/if-else

if (Condition1)

{

// Condition1 is true.

}

else if (Condition2)

{

// Condition1 is false and Condition2 is true.

}

else if (Condition3)

{

if (Condition4)

{

// Condition1 and Condition2 are false. Condition3 and Condition4 are true.

}

else

{

// Condition1, Condition2, and Condition4 are false. Condition3 is true.

}

}

else

{

// Condition1, Condition2, and Condition3 are false.

}