2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -4,10 +4,17 @@
|
|||
{{omit from|GW-BASIC}}
|
||||
{{omit from|MATLAB|MATLAB has no multiline string literal functionality}}
|
||||
|
||||
A here document (or "heredoc") is a way of specifying a text block, preserving the line breaks, indentation and other whitespace within the text.
|
||||
A ''here document'' (or "heredoc") is a way of specifying a text block, preserving the line breaks, indentation and other whitespace within the text.
|
||||
|
||||
Depending on the language being used a here document is constructed using a command followed by "<<" (or some other symbol) followed by a token string.
|
||||
Depending on the language being used, a ''here document'' is constructed using a command followed by "<<" (or some other symbol) followed by a token string.
|
||||
|
||||
The text block will then start on the next line, and will be followed by the chosen token at the beginning of the following line, which is used to mark the end of the textblock.
|
||||
The text block will then start on the next line, and will be followed by the chosen token at the beginning of the following line, which is used to mark the end of the text block.
|
||||
|
||||
The task is to demonstrate the use of here documents within the language.
|
||||
|
||||
;Task:
|
||||
Demonstrate the use of ''here documents'' within the language.
|
||||
|
||||
|
||||
;Related task:
|
||||
* [[Documentation]]
|
||||
<br><br>
|
||||
|
|
|
|||
17
Task/Here-document/Fortran/here-document.f
Normal file
17
Task/Here-document/Fortran/here-document.f
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
INTEGER I !A stepper.
|
||||
CHARACTER*666 I AM !Sufficient space.
|
||||
I AM = "<col72
|
||||
C 111111111122222222223333333333444444444455555555556666666666
|
||||
C 123456789012345678901234567890123456789012345678901234567890123456789
|
||||
1 <col72
|
||||
2 I AM <col72
|
||||
3 <col72
|
||||
4 THAT I AM <col72
|
||||
5"
|
||||
|
||||
Chug through the text blob.
|
||||
DO I = 0,600,66 !Known length.
|
||||
WRITE (6,1) I AM(I + 1:I + 66) !Reveal one line.
|
||||
1 FORMAT (A66) !No control characters are expected.
|
||||
END DO !On to the next line.
|
||||
END
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
my $color = 'green';
|
||||
my $text = qq :to 'EOT';
|
||||
some line
|
||||
color: $color
|
||||
last line
|
||||
EOT
|
||||
|
||||
my $text = qq :to 'END';
|
||||
some line
|
||||
color: $color
|
||||
another line
|
||||
END
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue