Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
CoffeeScript is a small language that compiles to JavaScript, created by Jeremy Ashkenas and released in 2009. It trades JavaScript's braces and semicolons for significant indentation and adds comprehensions, a clean function arrow, and Ruby-style string interpolation. During the early 2010s it was widely bundled with Ruby on Rails, and much of its syntax later influenced ES6; the language is still maintained, with 2.7.0 as the current release. On XCODX, your CoffeeScript is compiled and then run on Node.js inside the Piston sandbox, so it is server-side JavaScript with no browser and no DOM. You have Node's built-in modules for input and output, the runtime version is shown in the badge, and nothing needs to be installed.
readline = require 'readline'
rl = readline.createInterface input: process.stdin, output: process.stdout
rl.question 'What is your name? ', (name) ->
console.log "Hello, #{name}!"
console.log "Your name has #{name.length} characters."
rl.close()
CoffeeScript appeals to developers who want terse, indentation-based syntax that still produces ordinary JavaScript, and it remains handy for maintaining legacy codebases from its Rails-era peak. Choose it when you prefer its clean function and comprehension syntax and are comfortable with a language that compiles down to JS. Because modern JavaScript adopted arrow functions, destructuring, and classes, much of CoffeeScript's original advantage has narrowed, so it is a poor fit for greenfield projects where TypeScript is now common. In this sandbox it is a convenient way to see how CoffeeScript maps onto Node.js and to run small server-side snippets.
No. Your code compiles to JavaScript and runs on Node, but only Node's built-in modules are available. There is no npm install and no network access, so third-party packages from the npm registry cannot be required.
Use Node's built-in readline module, for example readline = require 'readline' and then rl.question. On XCODX you type answers into the live terminal as the program runs, or place them in the Stdin Box beforehand; Ctrl+D closes the input stream.
No. It is compiled to JavaScript and executed by Node.js on the server side, so there is no DOM and no window or document object. Use console.log for output rather than any browser API.
It is still maintained, but many of its best ideas, including arrow functions, destructuring, classes, and string interpolation, are now part of standard JavaScript. It remains useful for existing codebases, while most new projects choose plain JavaScript or TypeScript.
On XCODX the sandbox runs the compiled program rather than displaying the intermediate JavaScript. To study the output you can install the coffee compiler locally and run coffee --compile, or use the official Try CoffeeScript page.
CoffeeScript is a separate syntax that compiles into JavaScript; it uses indentation instead of braces and adds comprehensions and implicit returns. The running program is ordinary JavaScript, so anything CoffeeScript does is ultimately expressible in JS.
main.coffeecoffeescriptno standard input constructconsole.log "Hello from CoffeeScript!"
console.log "Welcome to XCODX Online Compiler!"
message = "CoffeeScript is elegant!"
console.log message