// c
#include <stdio.h>
typedef struct data_s {
int a;
unsigned long b;
} data_t;
int main(int argc, char** argv) {
printf("Hello, World!");
return 0;
}
// javascript
function hello(x) {
console.log('hello, ' + x + '!');
}
const hi = x => {
console.log(`hi, ${x}`);
};
hello('world');
/* css */
pre {
font-family: 'monospace';
margin: 24px 0;
padding: 8px;
background: #f8f8f8;
border: 1px solid #eee;
overflow: auto;
}
<!-- html/xml -->
<html lang="en">
<body>
<span>hello, world!</span>
</body>
</html>
# python
import math
def fn(x):
return math.sqrt(x + 1)
print(fn(42))
# ruby
class HelloWorld
def initialize(name)
@name = name.capitalize
end
def sayHi
puts "Hello #{@name}!"
end
end
hello = HelloWorld.new("World")
hello.sayHi
// java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
// numbers
123
+123
-123
12.3
12.34.5 // 12.34 and .5
+12e+3
#abc // hex col
#1a2b3c
// div vs regexp
1/2
1/2/3
1/2 + 2/3
a/2 + 2/3
/2 + 2/3
=/1 + 2/3
+/1 + 2/3
-/1 + 2/3
/1 + 2/3
// strings
xyz 'ab"c\'d`e' xyz
xyz'ab"c\'d`e'xyz
xyz "ab\"c'd`e" xyz
xyz"ab\"c'd`e"xyz
xyz `ab"c'd\`e` xyz
xyz`ab"c'd\`e`xyz
// strings vs regexp
'bc\'de'
/a[0-9]"'/
/a\/*/
'b/"c"de'
'/bc/'
/a*"/bc"