Brain ![]() |
http://brain.sourceforge.net |
Description: | "Brain is a high-level, purely object-oriented, prototype based
scripting language mostly similar to the Self language. Some
features of Brain are:
|
Factorial | Michael Neumann |
fac = {|n|
(n > 1) if-true: { n * fac (n-1) }
if-false: { 1 }.
}.
-- call the code-block and output the value
fac (6); println.
|
Calculates the factorial. Results
720 . |
Hello World | Michael Neumann |
-- Hello World in Brain #! this is also a single line comment {- and a multi-liine comment. -} "Hello World" println. |
Prints "Hello World" onto the
screen. |
Squares | Chad Fowler |
#! Squares in Brain
1 to: 10 by: 1 do: { | i | (i * i) println. }
|
Outputs the squares from 1 to
10. |