== Ruby == Cobra, like Ruby, has a high level syntax and garbage collection to enable rapid coding. One of the first things Ruby users want to know, is if Cobra supports blocks. Yes, it does. They are sometimes referred to as "anonymous methods" and "closures" so keep your eyes open for those terms on the discussion forums. Blocks are indicated by the keyword "do". If there are any arguments to pass they are declared in the same way as methods and signatures: with a parenthesized list of arguments. The body of the block then follows on the next line, indented one level. See the [http://cobra-language.com/trac/cobra/browser/cobra/trunk/Tests/320-misc-two/820-anonymous-methods-aka-closures test cases] for examples. Also of interest to Ruby users, Cobra has [MixIn mix-ins] and [TypeExtensions type extensions]. Cobra has some interesting characteristics for Ruby developers including a huge increase in performance, native threads, built-in contracts, built-in unit tests and more. Although Ruby is not Python, Ruby users may glean some characteristics of Cobra by reading [PythonLanguage comments about Python], which are more detailed. == Code Examples == === Class Declaration === Ruby: {{{ #!ruby class A < B def foo puts 'foo' bar end def bar print 'bar' end end }}} Cobra: {{{ #!python class A inherits B def foo print 'foo' .bar def bar print 'bar' stop }}} === Instantiation === Ruby: {{{ #!ruby obj = SomeClass.new(arg1, arg2) }}} Cobra: {{{ #!python obj = SomeClass(arg1, arg2) }}} === Blocks === Ruby: {{{ #!ruby method do |arg| end }}} Cobra: {{{ #!python .method(do(arg)) }}} == See Also == * OtherLanguages * HowToPrograms * PythonLanguage