Setting multiple variables

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Setting multiple variables

Post by MURTUMA » 05 Jan 2015 11:11

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?

andy
Posts: 40
Joined: 29 Dec 2014 21:00

Re: Setting multiple variables

Post by andy » 05 Jan 2015 13:21

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

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Setting multiple variables

Post by MURTUMA » 05 Jan 2015 14:36

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.

andy
Posts: 40
Joined: 29 Dec 2014 21:00

Re: Setting multiple variables

Post by andy » 05 Jan 2015 15:03

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

Post Reply