| Cobra | |
|---|---|
| Paradigm | Multi-paradigm:object-oriented |
| Designed by | Charles Esterbrook |
| Developer | Cobra Language LLC |
| First appeared | 2006; 19 years ago (2006) |
| Final release | 0.9.6 / December 23, 2013; 11 years ago (2013-12-23) |
| Typing discipline | strong,static,dynamic,inferred |
| OS | Microsoft .NET,Mono |
| License | MIT |
| Filename extensions | .cobra |
| Website | cobra-language |
| Influenced by | |
| Python,Eiffel,C#,Objective-C | |
Cobra is a discontinuedgeneral-purpose,object-orientedprogramming language.[1] Cobra is designed by Charles Esterbrook, and runs on theMicrosoft .NET andMono platforms.[2] It is strongly influenced byPython,C#,Eiffel,Objective-C, and other programming languages.[3] It supports bothstatic anddynamic typing.[4][5] It has support forunit tests and contracts.[4] It haslambda expressions, closures,list comprehensions, andgenerators.[6]
Cobra is anopen-source project; it was released under theMIT License on February 29, 2008.[7][8]
in andimplies operatorfor expressionscobra -doc)cobra -highlight)The following examples can be run from a file usingcobra<filename>.
classHellodefmainprint'HELLO WORLD'
classPersonvar_nameasStringvar_ageasintcueinit(nameasString,ageasint)_name,_age=name,agedeftoStringasStringisoverridereturn'My name is [_name] and I am [_age] years old.'