Cobra is a statically typed language for the CLR (as Boo). From its web page:
Cobra is a general purpose programming
language with:
- a clean, high-level syntax
- static and dynamic binding
- first class support for unit tests and contracts
- compiled performance with scripting conveniences
- lambdas and closures
- extensions and mixins
- ...and more
Sample code:
"""
This is a doc string for the whole module.
"""
class Person
"""
This is a class declaration.
"""
var _name as String # declare an object variable. every instance of Person will have a name
var _age as int
cue init(name as String, age as int)
_name = name
_age = age
def sayHello
# This is a method
# In strings, anything in brackets ([]) is evaluated as an expression,
# converted to a string and substituted into the string:
print 'Hello. My name is [_name] and I am [_age].'
def add(i as int, j as int) as int
""" Adds the two arguments and returns their sum. """
return i + j