Hi TJ, thanks for the explanation! Then I will stick to regexp("strfoo", MyAdd ?: "" ) to avoid any undefined corners. Cheers and thanks, Thomas On 12/05/2021 16.13, John M Knoeller wrote:
Yes, the ?: "operator" works when the first argument is a function, so  Âfn(x) ?: ywill return the result of evaluating fn(x) if it isn't undefined and y otherwise. But you need to write the expressions so that if f(x) is a boolean then y is also a boolean. Âso thisÂregexp("strfoo",MyAdd) ?: "" Should probably be this instead Âregexp("strfoo",MyAdd) ?: falseOr you could put the ?: inside the function call to make sure that the regular expression check never returns undefinedÂregexp("strfoo", MyAdd ?: "" ) -tj ------------------------------------------------------------------------*From:* HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> on behalf of Thomas Hartmann <thomas.hartmann@xxxxxxx>*Sent:* Wednesday, May 12, 2021 7:27 AM *To:* HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx> *Subject:* [HTCondor-users] class ad logic with undef (non-)equal Hi all, a short `undef` logic question: I wrote a statement like  ( Expr1 || regexp('strfoo',MyAdd) ) != true Unfortunately, I had assumed, that the regexp macro should always resolve to  ( Expr1 || true/false ) != true but Kruno pointed out, that in case the ad is undef the macro is not defined as well - which would result in  undef != true ð So, one question would be, if there is a `?`-like operator for a boolean non-equal comparison, that resolves in false when compared to undef? To catch undef cases, we are going now for  ( Expr1 || regexp('strfoo',MyAdd) ? : "" ) ) != true but we are not sure, if `?` as operator actually catches undefs here? Cheers,  Thomas _______________________________________________ HTCondor-users mailing list To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a subject: Unsubscribe You can also unsubscribe by visiting https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users The archives can be found at: https://lists.cs.wisc.edu/archive/htcondor-users/
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature