bash
#!/bin/bash
if [ $a -eq true ]
then
echo "A 'a'"
else
echo "B 'b'"
fi
function foo(a) {
local a = 0
count = a + 1
echo count
return
}
# comment
: <<COMMENT
comment line a
true comment line b
COMMENT
: <<x
comment line a
true comment line b
x
: '
comment line a
true comment line b
'
bash (scroll example)
#!/bin/bash
if [ $a -eq true ]
then
echo "A 'a'"
else
echo "B 'b'"
fi
#example to showcase the horizontal scroll with the numbers fading over the code.
c
#include <stdio.h>
#include "library.h"
#ifndef EXTENDED
/* defined */
#else
/* undefined */
#endif
int foo(int a) {
int count;
int quo;
a = 0;
count = a + 1;
if (a == 1) {
printf("A 'a'");
} else {
printf('B "b"');
}
return count;
}
// comment
/* comment line a
true comment line b
*/
cpp
#include <iostream>
#include "library.h"
using namespace std;
#ifndef EXTENDED
/* defined */
#else
/* undefined */
#endif
int foo(int a) {
int a = 0;
int count = a + 1;
if (a == true) {
cout << "A 'a'" << endl;
} else {
cout << 'B "b"'<< endl;
}
string quo = R"(
quote line a
quote line b
)";
return count;
}
// comment that extends to the edge of the box without wordwrap
/* comment line a
true comment line b
*/
cs
#include "library.h"
#include <header name>
#ifndef EXTENDED
/* defined */
#else
/* undefined */
#endif
void foo(int a) {
a = 0;
count = a + 1
if ( a == true ) {
Console.WriteLine( "A 'a'" );
} else {
Console.WriteLine( "B 'b'" );
}
return count;
}
// comment
/* comment line a
true comment line b
*/
fs
let addTuple aTuple =
let (x,y) = aTuple
x + y
let foo a =
let a = 0;
let count = a + 1
if a == true then printfn "A 'a'";
else printfn "B 'b'";
// comment
/* comment line a
true comment line b
*/
go
package main
import "fmt"
func main() {
var a = 0
var b = true
count := a + 1
if b == true {
fmt.Println("A 'a'")
} else {
fmt.Println(`B "b"`)
}
var quo = `
quote line a
quote line b
`
concatenated := fmt.Sprintf("%d%s", count, quo)
fmt.Println(concatenated)
}
// comment
/* comment line a
true comment line b
*/
html
<!DOCTYPE html>
<html>
<body>
<!-- <!DOCTYPE html>
-->
<!--h1>foo</h1-->
<h1>My First Heading</h1>
<p class='test'>My first paragraph.</p>
<a href="https://www.w3schools.com">
This is a link
</a>
</body>
</html>
java
import library.*;
public class Main {
public static void main(String[] args) {
int foo(int a) {
int a = 0;
int count = a + 1;
if (a == true) {
System.out.println("A 'a'");
} else {
System.out.println("B 'b'");
}
String quo = "quote line a\n" +
"quote line b";
// Java 13 Text Blocks
String quo = """quote line
quote line b""";
return count;
}
}
}
// comment
/* comment line a
true comment line b
*/
javascript
import * from "library.js";
import { library } from "library.js";
function foo(a){
var a = 0;
var count = a + 1;
if ( a == true ) {
console.log( "A 'a'" );
} else {
console.log( `B "b"` );
}
var quo = `
quote line a
quote line b
`;
return count;
};
// comment
/* comment line a
true comment line b
*/
export { foo };
kotlin
package main
import library as library;
fun foo(a: Int): Int {
var a = 0
var count = a + 1
if (a == true) {
println("A 'a'")
} else {
println("B 'b'")
}
val quo = """
quote line a
quote line b
""".trimIndent()
return count
}
// comment
/* comment line a
true comment line b
*/
matlab
library = importdata('library.js');
function count = foo(a)
a = 0;
count = a + 1;
if (a == true)
disp('A "a"');
else
disp('B "b"');
end
quo = sprintf('quote line a');
return count;
end
%comment
%{ comment
comment line a
true comment line b
%}
perl
sub foo {
my ($a) = @_;
my $a = 0;
my $count = $a + 1;
if ($a == True) {
print "A 'a'";
} else {
print 'B "b"';
}
my $quo = <<END;
quote line a
quote line b
END
return $count;
}
#comment
=pod
comment line a
True comment line b
=cut
python
from library.js import *
from library.js import library
def foo(a):
a = 0
count = a + 1
if a == True:
print("A 'a'")
else:
print('B "b"')
quo = """
quote line a
quote line b
"""
return count
# comment
"""
comment line a
True comment line b
"""
'''
comment line a
True comment line b
'''
r
source("library.js")
foo <- function(a) {
a <- 0
count <- a + 1
if (a == TRUE) {
cat("A 'a'")
} else {
cat('B "b"')
}
quo <- c(
"quote line a",
"quote line b"
)
return(count)
}
# comment
vb
'comment'
System.Console.WriteLine("Log text")
Dim UserName As String = "MyUserName"