Skip to content

cotrPrintMulti

Prints a multi-line message to the console

Aliases:

  • cotrPrintMulti
  • printMultiLine

cpp

#include <iostream>
std::cout << "Line 1" << std::endl
<< "Line 2" << std::endl
<< "Line 3" << std::endl;

csharp

Console.WriteLine(@"""
Line 1
Line 2
Line 3
""");

dart

print('''
Line 1
Line 2
Line 3
''');

go

fmt.Println(`
Line 1
Line 2
Line 3
`)

haskell

putStrLn unlines [
"Line 1",
"Line 2",
"Line 3"
]

java

System.out.println("Line 1" +
"\nLine 2" +
"\nLine 3");

javascript

console.log(`
Line 1
Line 2
Line 3
`);

javascriptreact

console.log(`
Line 1
Line 2
Line 3
`);

kotlin

println("""
Line 1
Line 2
Line 3
""")

perl

print <<'END_STRING';
Line 1
Line 2
Line 3
END_STRING

php

echo <<<EOT
Line 1
Line 2
Line 3
EOT;

powershell

Terminal window
Write-Host @"
Line 1
Line 2
Line 3
"@;

python

print('''
Line 1
Line 2
Line 3
''')

r

cat{1:"Line 1",
{2:"Line 2",
{3:"Line 3")

ruby

puts """Line 1
Line 2
Line 3"""}

rust

println!("{}
{}
{}",
"Line 1",
"Line 2",
"Line 3"
);

scala

println("""
Line 1
Line 2
Line 3
""")

shellscript

Terminal window
# Use echo with -e for multi-line output:
echo -e "Line 1\nLine 2\nLine 3"

swift

print("""
Line 1
Line 2
Line 3
""")

typescript

console.log(`
Line 1
Line 2
Line 3
`);

typescriptreact

console.log(`
Line 1
Line 2
Line 3
`);