Andrey Lisin's Blog home

Code Examples

10 Apr 2013

Let's try to write some code chunks.

Python is the first:

1
2
def fun(a, b):
    return a + b

Now is the C++ turn:

1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;

int main()
{
    cout << "Hello, Pelican!" << endl;
    return 0;
}

Erlang?

1
2
factorial(0) -> 1;
factorial(N) -> N * factorial(N-1).

Clojure?

1
(defn double-me [x] (* 2 x))

And even Brainfuck?

1
2
3
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++
 .>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.
 ------.--------.>+.>.

Aye! Even Brainfuck!

Summing up...

...highlighting works very well :)