class MyProgram
def main
print 'Hello, [.name]'
get name as string
return 'world'
Cobra is case-sensitive so the line "get name as string" will give an error:
MyProgram.cobra: error: Cannot find type for "string". Try "String". Also, consider the -correct-source option (see cobra -h for details).
Leave the source in its bad state and try compiling again with the -correct-source option:
cobra -c -correct-source MyProgram.cobra
You will get no error:
Compilation succeeded
And you will find that the compiler wrote back the source code file with "String":
class MyProgram
def main
print 'Hello, [.name]'
get name as String
return 'world'
This works best when you can configure your editor to automatically reload files that have changed.
If you have any questions, let me know.