Skip to main content
Known Participant
May 5, 2022
解決済み

I have my background change color when value is entered, but how do I add numerous value

For example v==3 turns red.  I would like to turn red if 9, 15, 21, 25, 27, 29 is entered.   How do I go about doing this?  Do I have to do invidual lines or do I put && between values?

My code knowledge is about .01.. I just find what I'm looking for online and tweak it.

 

var v = Number(event.value);
if (v==1) {event.target.fillColor = color.green;}
else if (v==2) {event.target.fillColor = color.yellow;}
else if (v==3) {event.target.fillColor = color.red;}
else event.target.fillColor = color.white;

 

 

このトピックへの返信は締め切られました。
解決に役立った回答 Nesa Nurani

You can't use && that would mean that multiple values exist at the same time, instead use || (or)

(v==1 || v==9 || v==15...etc)

返信数 3

Nesa Nurani
Community Expert
Nesa NuraniCommunity Expert解決!
Community Expert
May 5, 2022

You can't use && that would mean that multiple values exist at the same time, instead use || (or)

(v==1 || v==9 || v==15...etc)

JetFixxxer作成者
Known Participant
May 5, 2022

Thank you, much appreciated!