View Single Post
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, España
#11
Originally Posted by velox View Post
Try something like:

I have not tested it in any way, just quickly written it down, so I may have missed something or it may not be correct syntax (I may or may not have even added errors on purpose to help you learn – just kidding). More or less interesting points are:
  • there is a new property with an integer type, this should fix the negative comparisons
  • You had a gap (no colours between -1 and 4) between where you switched to "<=" – it's easier to just stick with ">=" and make an else for everything that does not match.

Keep in mind:
Long lists of if/else almost always are a sign that something could be better thought out.
Thank you velox, your code appears to work

I formatted your code exactly as you've posted and it appears to work. I think I may need to change some of the colours, like dark red and red are barely distinguishable.

I wholly agree with your comments about if/else being a sign that improvement is required. I am now looking into it......always learning along the way, mainly how NOT to do it!

Thanks, your input is appreciated.
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following User Says Thank You to Markkyboy For This Useful Post: