-
before the initial appearance of the delimiter or not, i.e., depending on whether one writes something like <<EOF
or <<-EOF
(where EOF
is replaced with whatever delimiter one wishes to use).
-
before the initial appearance of the delimiter or not, i.e., depending on whether one writes something like <<EOF
or <<-EOF
(where EOF
is replaced with whatever delimiter one wishes to use).
-
but with a different meaning than either having it or not in a Bourne-style shell. In Bourne-style shells, the closing delimiter must never have leading whitespace. In Crystal, the closing delimiter may have leading whitespace, and that much leading whitespace is removed from each line in the here document.
count0 = <<-STOP.count &.whitespace? one two three four five six seven eight nine STOP puts "There are #{count0} whitespace characters with an unindented delimiter." count1 = <<-STOP.count &.whitespace? one two three four five six seven eight nine STOP puts "There are #{count1} whitespace characters with a slighly indented delimiter." count2 = <<-STOP.count &.whitespace? one two three four five six seven eight nine STOP puts "There are #{count2} whitespace characters with a more indented delimiter."
There are 14 whitespace characters with an unindented delimiter. There are 11 whitespace characters with a slighly indented delimiter. There are 8 whitespace characters with a more indented delimiter.
File
objects) have .lines
which is nicer than .split('\n')
, so that can be written: