Where else can I use the logical operators like &&?

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: Azhrei, dorpond, trevor, giliath, jay, Mr.Ice

Post Reply
Charlweed
Kobold
Posts: 12
Joined: Thu Apr 16, 2015 3:14 pm

Where else can I use the logical operators like &&?

Post by Charlweed »

I was surprised that this code does not work, though && works as a condition in "if" roll options:

Code: Select all

[h: first = 0]
[h: second = 1]
[e: invalid = first && second]
It fails with the error
java.lang.NullPointerException error executing expression invalid = first && second.

I was even more surprised to find that the following does work:

Code: Select all

[h: first = 0]
[h: second = 1]
[e: lgkAnd = and(first,second)]
Because the "and()" function is not documented on the wiki! Not even on https://lmwcs.com/rptools/wiki/Category ... l_Function
So, outside of "if", where/why can I use logical and conditional operators?
And where might there be documentation on "and()" and other logical functions?
Thanks!

User avatar
aliasmask
Deity
Posts: 8580
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Where else can I use the logical operators like &&?

Post by aliasmask »

&& is a logical operator and so can only be used where those are being evaluated. and() is a function and it's handled differently than an overloading operator like &&.

Post Reply

Return to “Macros”