Top 1,000 Features Creators Resources Blog Explorer Download
GitHub icon

CoffeeScript

< >

CoffeeScript is an open source programming language created in 2009 by Jeremy Ashkenas.

#47on PLDB 15Years Old 65kRepos

Try now: Riju ยท TIO ยท Replit

CoffeeScript is a programming language that transcompiles to JavaScript. It adds syntactic sugar inspired by Ruby, Python and Haskell in an effort to enhance JavaScript's brevity and readability. Specific additional features include list comprehension and pattern matching. Read more on Wikipedia...


Example from Riju:
console.log "Hello, world!"
Example from hello-world:
alert "Hello World"
// Hello world in CoffeeScript alert "Hello, World!"
Example from Linguist:
console.log "Hello, World!"
Example from Wikipedia:
author = "Wittgenstein" quote = "A picture is a fact. -- #{ author }" sentence = "#{ 22 / 7 } is a decent approximation of ฯ€"
CoffeeScript Keywords
and or is isnt not on yes @ no off true false null this new delete typeof in instanceof return throw break continue debugger if else switch for while do try catch finally class extends super undefined then unless until loop of by when

Language features

Feature Supported Token Example
Integers โœ“
# [0-9]+
Floats โœ“
# [0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?
Hexadecimals โœ“
# 0x[0-9a-fA-F]+
Conditionals โœ“
Inheritance โœ“
Switch Statements โœ“
Exceptions โœ“
Classes โœ“
While Loops โœ“
Booleans โœ“ true false
Regular Expression Syntax Sugar โœ“
Strings โœ“ "
MultiLine Comments โœ“ ###
### A comment
###
Print() Debugging โœ“ console.log
Line Comments โœ“ #
# A comment
Semantic Indentation โœ“
Comments โœ“
Case Insensitive Identifiers X
Variable Substitution Syntax X

View source

- Build the next great programming language ยท About ยท Acknowledgements ยท Extensions ยท Day 626 ยท feedback@pldb.io