| 1 | == Ruby == |
| 2 | |
| 3 | 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. |
| 4 | |
| 5 | 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. |
| 6 | |
| 7 | See the [http://cobra-language.com/trac/cobra/browser/cobra/trunk/Tests/320-misc-two/820-anonymous-methods-aka-closures test cases] for examples. |
| 8 | |
| 9 | Also of interest to Ruby users, Cobra has [MixIn mix-ins] and [TypeExtensions type extensions]. |
| 10 | |
| 11 | 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. |
| 12 | |
| 13 | Although Ruby is not Python, Ruby users may glean some characteristics of Cobra by reading [PythonLanguage comments about Python], which are more detailed. |
| 14 | |
| 15 | See also: OtherLanguages, PythonLanguage |