Forums: Multiple colors - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Multiple colors Multiple colors Rate Topic: -----

#1 User is offline   ijunior 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: 01-June 19

Posted 16 June 2019 - 02:55 PM

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
0

#2 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16451
  • Joined: 03-February 03
  • Gender:Male

Posted 16 June 2019 - 11:36 PM

C# languages reference will be a good start:
https://docs.microso...eywords/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.
}

Best regards,
Sergey Kornilov
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users