Bash
#!/bin/bash
###### BEGIN CONFIG
ACCEPTED_HOSTS="/root/.hag_accepted.conf"
BE_VERBOSE=false
###### END CONFIG
if [ "$UID" -ne 0 ]
then
echo "Superuser rights is required"
echo 'Printing the # sign'
exit 2
fi
if test $# -eq 0
then
elif test [ $1 == 'start' ]
else
fi
genApacheConf(){
if [[ "$2" = "www" ]]
then
full_domain=$1
else
full_domain=$2.$1
fi
host_root="${APACHE_HOME_DIR}$1/$2/$(title)"
echo -e "# Host $1/$2 :"
}
OCaml
(* This is a
multiline, (* nested *) comment *)
type point = { x: float; y: float };;
let some_string = "this is a string";;
let rec length lst =
match lst with
[] -> 0
| head :: tail -> 1 + length tail
;;
exception Test;;
type expression =
Const of float
| Var of string
| Sum of expression * expression (* e1 + e2 *)
| Diff of expression * expression (* e1 - e2 *)
| Prod of expression * expression (* e1 * e2 *)
| Quot of expression * expression (* e1 / e2 *)
class point =
object
val mutable x = 0
method get_x = x
method private move d = x <- x + d
end;;
Swift
use std;
#![warn(unstable)]
/* Factorial */
fn fac(n: int) -> int {
let s: str = "This is
a multi-line string.
It ends with an unescaped '\"'.";
let c: char = 'ะค';
let r: str = r##" raw string "##;
let result = 1, i = 1;
while i <= n { // No parens around the condition
result *= i;
i += 1;
}
ret result;
}
pure fn pure_length<T>(ls: list<T>) -> uint { /* ... */ }
type t = map::hashtbl<int,str>;
let x = id::<int>(10);
// Define some modules.
#[path = "foo.rs"]
mod foo;
impl <T> Seq<T> for [T] {
fn len() -> uint { vec::len(self) }
fn iter(b: fn(T)) {
for elt in self { b(elt); }
}
}
enum list<T> {
Nil;
Cons(T, @list<T>);
}
let a: list<int> = Cons(7, @cons(13, @nil));
struct Baz<'a> {
baz: &'a str,
}
'h: for i in range(0,10) {
'g: loop {
if i % 2 == 0 { continue 'h; }
if i == 9 { break 'h; }
break 'g;
}
}