Page 1 of 1

Setting multiple variables

Posted: 05 Jan 2015 11:11
by MURTUMA
This is quite a noob question but how can I set multiple variables at the same time?

if (light_level < 10)
{screen_brightness = "DIM (50/255)" AND global_nightmode = 1
};


This code obviously doesn't work, so what's wrong with it?

Re: Setting multiple variables

Posted: 05 Jan 2015 13:21
by andy
Hi,

It is much easier...

if (light_level < 10)
{
screen_brightness = "DIM (50/255)"

global_nightmode = 1
};

AND operator is only for boolean. For example
if (light_level<10 and dark_level>100)
{}

Regards

Andy

Re: Setting multiple variables

Posted: 05 Jan 2015 14:36
by MURTUMA
Yours is not perfect either. It needs half comma(or whatever ";" is called in english) on line changes but you gave me the right idea. The simplest of solutions is sometimes the best and this might be the only one I didn't try.

Thanks for your input.

Re: Setting multiple variables

Posted: 05 Jan 2015 15:03
by andy
Ooops hehe

You are right. I copied/pasted your snippet and only replaced AND by carridge return/line feedback

Good luck for next code lines