When I typed multiline in coffeescript interactive mode, an error occrured.
For example, I want to try the following code:
kids =
brother:
name: "Max"
age: 11
sister:
name: "Ida"
age: 9
This Error was displayed:
coffee> kids =
Error: In repl, Parse error on line 1: Unexpected 'TERMINATOR'
at Object.parseError (/usr/lib/coffeescript/parser.js:463:11)
at Object.parse (/usr/lib/coffeescript/parser.js:533:22)
at /usr/lib/coffeescript/coffee-script.js:26:22
at Object.eval (/usr/lib/coffeescript/coffee-script.js:64:17)
at Interface.<anonymous> (/usr/lib/coffeescript/repl.js:18:26)
at Interface.emit (events:27:15)
at Interface._ttyWrite (readline:309:12)
at Interface.write (readline:147:30)
at Stream.<anonymous> (/usr/lib/coffeescript/repl.js:35:17)
at Stream.emit (events:27:15)
I tried to use '\' as a newline,but the same error was displayed.
coffee> kids = \
Error: In repl, Parse error on line 1: Unexpected '\'
at Object.parseError (/usr/lib/coffeescript/parser.js:463:11)
at Object.parse (/usr/lib/coffeescript/parser.js:533:22)
at /usr/lib/coffeescript/coffee-script.js:26:22
at Object.eval (/usr/lib/coffeescript/coffee-script.js:64:17)
at Interface.<anonymous> (/usr/lib/coffeescript/repl.js:18:26)
at Interface.emit (events:27:15)
at Interface._ttyWrite (readline:309:12)
at Interface.write (readline:147:30)
at Stream.<anonymous> (/usr/lib/coffeescript/repl.js:35:17)
at Stream.emit (events:27:15)
I can't use multiline, so I can't use indentation.
What should I do?
My environment is the following:
OS: Ubuntu 10.04 lucid
coffeescript version 1.0.0 I installed coffeescript with PPA and apt-get command.
see this url: https://launchpad.net/~gezakovacs/+archive/coffeescript
You simple need to add a <script type="text/coffeescript" src="app. coffee"></script> to execute coffee script code in an HTML file. In other cases, I've seen people use the attributes of type="coffeescript" and type="coffee" , so they might work for you as well. Save this answer.
JavaScript file written in CoffeeScript, a programming language that compiles and transcompiles to JavaScript; saved in a text format and contains code that is similar to JavaScript, but modified to be more readable. CoffeeScript's aim is to enhance JavaScript's brevity and readability.
You can also switch to multiline mode with Ctrl+V.
backslash works fine with my coffee 1.2.1... try to upgrade :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With