In the explanation for the above code, they mention the pipe (|) and the function trimMargin(), but the explanation doesnโt quite jive with the actual code. i.e., indentation can be achieved without using the pipe at all, so itโs not at clear what effect, if any, the pipe is achieving.
Great catch! Thank you so much for reporting this, we really appreciate it.
I have submitted the let to val fix to our editor, as well as an updated explanation copied below. Please let me know what you think!
The three double-quotes signify that this is a multi-line string. Handily, trimMargin() will remove new lines at the beginning and end of the string to remove unnecessary white space. This way, you are not forced to put the """ on the same line as the string. Finally, the | character (known as a โpipeโ) ensures that all preceding white space from each line is removed, giving you more flexibility in indentation without affecting the output.