Long literals, with continuations: Difference between revisions

m (→‎{{header|REXX}}: added zkl header)
(→‎{{header|zkl}}: added code)
Line 301:
 
=={{header|zkl}}==
This solution uses a "doc string", a chunk of text that the parser eats
<lang zkl></lang>
verbatim. It starts and ends with #<<<. If started with #<<<", a leading " is
<lang zkl></lang>
added to the text. The text is then parsed as one [long] line.
 
The string split method creats a list of items split at white space
(by default). To turn that into one string with one space between each item,
use: elements.concat(" ")
 
The __DATE__ constant is a compile time constant, which is often different
from the last modified date of the source file (as programs are often run
as source).
<lang zkl></lang>elements:=
#<<<"
hydrogen helium lithium beryllium boron carbon
nitrogen oxygen fluorine neon sodium magnesium
aluminum silicon phosphorous sulfur chlorine argon
potassium calcium scandium titanium vanadium chromium
manganese iron cobalt nickel copper zinc
gallium germanium arsenic selenium bromine krypton
rubidium strontium yttrium zirconium niobium molybdenum
technetium ruthenium rhodium palladium silver cadmium
indium tin antimony tellurium iodine xenon
cesium barium lanthanum cerium praseodymium neodymium
promethium samarium europium gadolinium terbium dysprosium
holmium erbium thulium ytterbium lutetium hafnium
tantalum tungsten rhenium osmium iridium platinum
gold mercury thallium lead bismuth polonium
astatine radon francium radium actinium thorium
protactinium uranium neptunium plutonium americium curium
berkelium californium einsteinium fermium mendelevium nobelium
lawrencium rutherfordium dubnium seaborgium bohrium hassium
meitnerium darmstadtium roentgenium copernicium nihonium flerovium
moscovium livermorium tennessine oganesson"
.split();
#<<<
println("Date of this compile: ",__DATE__);
println(elements.len()," elements, the last being \"",elements[-1],"\"");</lang>
{{out}}
<pre>
Date of this compile: 2020-03-23
 
118 elements, the last being "oganesson"
</pre>
Anonymous user