Hi,
Will all of these work? if the condition is indeed true? do I need to specify === true, or this is needed only if I want === false ? I guess i need 3 === not 2 == for this boolean value to work?
if(ACRooms1.changedSince(now.minusMinutes(3))) { do something
if(ACRooms1.changedSince(now.minusMinutes(3)) === true){ do something
if(ACRooms1.changedSince(now.minusMinutes(3)) == true){ do something
I know what it will write as output, either true or false, I already wrote it to the log…
I am just asking for the logic, if you specify nothing, no =true or =false, is the default behavior that things will happen if its true, or nothing will happen?
EDIT: now I see you are not suggesting to write the boolean value, just to test if it will write anything or not. ok thx.
ps. what is the correct way of writing
Ephemeris.isWeekend == true
or
Ephemeris.isWeekend === true
In other words, == is comparing the object’s contents, similar to java’s equals(), whereas === is comparing that the two objects are one and the same exact instance of the object. I was recently told off from over explaining, so I’ll stop here. If you need further clarifications, you can either google more or ask here.
If the value is a boolean, the == true or === true is redundant and not needed. This is the case for all programming languages I’m familiar with. Some like to include the == true to help make the code self documenting but I think most find that weird and irksome.
I never let that stop me.
If I did, I’d have left the forum a long time ago. No one person should control your behavior, so long as it’s within the code of conduct of the forum.
This is a case where I am speaking as a moderator (most of the time I’m speaking as just me).
The way I look at it, you are also helping future users of the forum, including LLMs.