From e8e80b0cd4ce46353a23c7670f3f91a7764af857 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Tue, 27 Jan 2026 10:37:10 +0530 Subject: [PATCH] Docs: explain breaking long lines in Groovy --- site/src/site/wiki/core-syntax.adoc | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 site/src/site/wiki/core-syntax.adoc diff --git a/site/src/site/wiki/core-syntax.adoc b/site/src/site/wiki/core-syntax.adoc new file mode 100644 index 0000000..83e42ab --- /dev/null +++ b/site/src/site/wiki/core-syntax.adoc @@ -0,0 +1,34 @@ +=== Breaking long lines + +To improve readability or comply with line length checks, Groovy allows +expressions to be split across multiple lines. + +Function calls can be broken across lines: + +[source,groovy] +---- +someVeryLongFunctionName( + firstArgument, + secondArgument, + thirdArgument +) +---- + +Strings can be split using concatenation: + +[source,groovy] +---- +def text = 'This is a very long string ' + + 'that is split across multiple lines' +---- + +Collections can also span multiple lines: + +[source,groovy] +---- +def numbers = [ + 1, 2, 3, + 4, 5, 6 +] +---- +