Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DFB77200CD7 for ; Tue, 18 Jul 2017 02:24:32 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DE08B166109; Tue, 18 Jul 2017 00:24:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 08128166105 for ; Tue, 18 Jul 2017 02:24:31 +0200 (CEST) Received: (qmail 28550 invoked by uid 500); 18 Jul 2017 00:24:26 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 28538 invoked by uid 99); 18 Jul 2017 00:24:26 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jul 2017 00:24:26 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id A31791A071B for ; Tue, 18 Jul 2017 00:24:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.679 X-Spam-Level: * X-Spam-Status: No, score=1.679 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id wEGd43tCjZu5 for ; Tue, 18 Jul 2017 00:24:23 +0000 (UTC) Received: from mail-qt0-f181.google.com (mail-qt0-f181.google.com [209.85.216.181]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 610A45FC4D for ; Tue, 18 Jul 2017 00:24:23 +0000 (UTC) Received: by mail-qt0-f181.google.com with SMTP id 21so4224085qtx.3 for ; Mon, 17 Jul 2017 17:24:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=8RQ+SpuCJx3lv3RUBJFVRV58Nns4QnGCtdGvC8t2WS0=; b=hkcte9Jb+k5UnX6HBR4FkzSshhJbHP6eLtD6Ck7fQuituUhRlThEiS1jBoau1GtVyH 3y6D87/RZsI01AkIfQMhzjdANiCLWDinkv81XEf99gmA+mxYtOnWLQF9GS0lYrByG5jk iXVqC3wAvrnCpSHB/FZ3EJlxoivwgyCCvN5L1G3xM4dUKQrOetip+dB0T7s0JE0MMdCU 03fALJw5Wd3qZkDqsBCg4cLefn1R7uTJGCqtRJGdklafYRzN+eWk+vWuYBAsdWlfpV+5 QHqU3N2g1vC3N4PDD2B9P441lO00ih5/0t6xe28PKBxT/WJsfplxLH7XWI0Rt9aUjk8v 5IBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=8RQ+SpuCJx3lv3RUBJFVRV58Nns4QnGCtdGvC8t2WS0=; b=mdgswqiiAvVxm1AXPuv2Wjeklj87oda4kt8Obyuu0ZXcFeSEIMUshrgHj9Uimt+37R 2VTflpgYOdiiSflwkO4D01skNYS3rskAlcxe6hglGGtecf1dIFXrKi4rM8FkPFzf9R3A TsqEgewYXI4Ftam6W42shmmF+GRfnK+qlfPUduBtVrfkKeV+C3yJeXSKpQ5vnGKhVYJg j2l3tWl01fF7TfREGbFTp3dE8otAMA84tgOEekFEEStTuyPIKvZhry471i7+JwmitOEM 6KfdHkWb0dz684oz07fRGhMfB+E4Hs+14AkdKCG4EZcXeiHzCx0aGQ9jebbgd3rKTbEd 9rtg== X-Gm-Message-State: AIVw113cgkq1LJveLR6qGhJVJ+GGQ1qq7Jltbc3j1QNEEHvsaaO864eH DyUcbjKAiLx0Wopbdp9HKy5XpA5fHUvG X-Received: by 10.237.60.80 with SMTP id u16mr258354qte.100.1500337457042; Mon, 17 Jul 2017 17:24:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.107.74 with HTTP; Mon, 17 Jul 2017 17:24:16 -0700 (PDT) In-Reply-To: References: From: Guy Matz Date: Mon, 17 Jul 2017 19:24:16 -0500 Message-ID: Subject: Re: foo() || return false ? To: users@groovy.apache.org Content-Type: multipart/alternative; boundary="94eb2c190dc02b993f05548c89d2" archived-at: Tue, 18 Jul 2017 00:24:33 -0000 --94eb2c190dc02b993f05548c89d2 Content-Type: text/plain; charset="UTF-8" Thanks so much for the reply! I'm not trying to do this, though: || false I'm trying to do this: || return false Is there a more groovy way? Thanks!! On Mon, Jul 17, 2017 at 5:06 PM, John Wagenleitner < john.wagenleitner@gmail.com> wrote: > That is not a valid start of an expression which is expected for the > binary expression (expr || expr) so that's why it wont compile. I am not > familiar with Scriptler and it is hard to tell without some more context, > but how about just: > > doSomething() > > You can simplify by dropping the `|| false`. If that's the last line in a > boolean returning method/context it will return true if doSomething() > returns a non-null/non-zero/non-false value, else false. Otherwise you > could coerce the value to a boolean with: > > doSomething() as boolean > > > On Mon, Jul 17, 2017 at 1:18 PM, Guy Matz wrote: > >> Hello! >> I'm trying to do the following in scriptler (Jenkins), but I can't get >> this to work: >> doSomething() || return false >> >> This fails in scripler with: >> >> Execution of script [promoteBuild.groovy] failed - org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: >> Script1.groovy: 51: unexpected token: return @ line 51, column 85. >> doSomething() || return fal >> >> >> Anyone know why this seemingly valid groovy does not work in scriptler? >> >> >> Thanks! >> >> >> P.S. - I asked the jenkins community but no one responded >> >> > --94eb2c190dc02b993f05548c89d2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks so much for the reply!=C2=A0 I'm not trying to = do this, though: || false

I'm trying to do this: || = return false

Is there a more groovy way?

Thanks!!


On Mon, Jul 17, 2017 at 5:06 PM, John= Wagenleitner <john.wagenleitner@gmail.com> wrote:=
That is not a valid sta= rt of an expression which is expected for the binary expression (expr || ex= pr) so that's why it wont compile. I am not familiar with Scriptler and= it is hard to tell without some more context, but how about just:

=
doSomething()

You can simplify by dropping the `|| fals= e`.=C2=A0 If that's the last line in a boolean returning method/context= it will return true if doSomething() returns a non-null/non-zero/non-false= value, else false.=C2=A0 Otherwise you could coerce the value to a boolean= with:

doSomething() as boolean


On Mon, Jul 17, 2017 at 1:18 PM, Guy Matz <guymatz@gmail.= com> wrote:
Hello!
I'm trying to do the following in scriptler (Jenkins), but I can&#= 39;t get this to work:
doSomething() |= | return false

This fails in scripler with:
Execution of script [promoteBuild.gro=
ovy] failed - org.codehaus.groovy.control.MultipleCompilationErrorsExcept=
ion: startup failed:
Script1.groovy: 51: unexpected token: return @ line 51, column 85.
   doSomething() || return fal

Anyone know why this seemingly valid groovy does not w= ork in scriptler?

Thanks!