Ternary operator formatting
Gianluca Sartori <[email protected]> Mon, 27 Jul 2026 14:38:32 +0200
| Newsgroups | gmane.comp.lang.groovy.devel |
|---|---|
| Message-ID | <CAEJ7v=kKE6H1ebkamuYWXLi-A2o0Rk42JYOXx5cO7esNUjg1qg@mail.gmail.com> |
--000000000000cd6faf0657970035
Content-Type: text/plain; charset="UTF-8"
Hi people,
I've proposed the following PR to the Grails project in a rush, but I guess
its proper place is the Groovy project.
https://github.com/apache/grails-core/pull/16055
We usually format ternary operators like this for readability:
String message = condition
? "Value when true"
: "Value when false"
Would you accept such PR on the groovy-developer skill?
Cheers,
Gianluca
Gianluca Sartori
--
https://dueuno.com
--000000000000cd6faf0657970035
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Hi people,<br clear=3D"all"></div><div><br></div><div=
>I've proposed the following PR to the Grails project in a rush, but I =
guess its proper=C2=A0place is the Groovy project.</div><div><br></div><div=
><a href=3D"https://github.com/apache/grails-core/pull/16055">https://githu=
b.com/apache/grails-core/pull/16055</a></div><div><br></div><div>We usually=
<span style=3D"background-color:transparent">=C2=A0format ternary operators=
like this for readability:</span></div><div><br></div><div>String message =
=3D condition<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ? "Value when true"<=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 : "Value when false"</div><div><br=
></div><div>Would you accept such PR on the groovy-developer skill?</div><d=
iv><br></div><div>Cheers,</div><div>Gianluca</div><div><br></div><div><div =
dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><d=
iv dir=3D"ltr">Gianluca Sartori<div>--</div><div><a href=3D"https://dueuno.=
com" target=3D"_blank">https://dueuno.com</a></div></div></div></div></div>
--000000000000cd6faf0657970035--