diff options
author | Zachary Ferguson <zfergus2@users.noreply.github.com> | 2015-10-07 23:53:53 -0400 |
---|---|---|
committer | Zachary Ferguson <zfergus2@users.noreply.github.com> | 2015-10-07 23:53:53 -0400 |
commit | 342488f6a8de5ab91f555a6463f5d9dc85a3079a (patch) | |
tree | 1afa96957269a218ef2a84d9c9a2d4ab462e8fef /es-es/coffeescript-es.html.markdown | |
parent | 4e4072f2528bdbc69cbcee72951e4c3c7644a745 (diff) | |
parent | abd7444f9e5343f597b561a69297122142881fc8 (diff) |
Merge remote-tracking branch 'adambard/master' into adambard/master-cn
Diffstat (limited to 'es-es/coffeescript-es.html.markdown')
-rw-r--r-- | es-es/coffeescript-es.html.markdown | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/es-es/coffeescript-es.html.markdown b/es-es/coffeescript-es.html.markdown new file mode 100644 index 00000000..6bf430e6 --- /dev/null +++ b/es-es/coffeescript-es.html.markdown @@ -0,0 +1,57 @@ +--- +language: coffeescript +lang: es-es +contributors: + - ["Tenor Biel", "http://github.com/L8D"] +translators: + - ["Pablo Elices", "http://github.com/pabloelices"] +filename: coffeescript-es.coffee +--- + +``` coffeescript +# CoffeeScript es un lenguaje hipster. +# Tiene convenciones de muchos lenguajes modernos. +# Los comentarios son como en Ruby y Python, usan almohadillas. + +### +Los comentarios en bloque son como estos, y se traducen directamente a '/*' y '*/' +para el código JavaScript resultante. + +Deberías entender la mayor parte de la semántica de JavaScript antes de continuar. +### + +# Asignación: +number = 42 #=> var number = 42; +opposite = true #=> var opposite = true; + +# Condiciones: +number = -42 if opposite #=> if(opposite) { number = -42; } + +# Funciones: +square = (x) -> x * x #=> var square = function(x) { return x * x; } + +# Rangos: +list = [1..5] #=> var list = [1, 2, 3, 4, 5]; + +# Objetos: +math = + root: Math.sqrt + square: square + cube: (x) -> x * square x +#=> var math = { +# "root": Math.sqrt, +# "square": square, +# "cube": function(x) { return x * square(x); } +#} + +# Número de argumentos variable: +race = (winner, runners...) -> + print winner, runners + +# Existencia: +alert "I knew it!" if elvis? +#=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } + +# Listas: +cubes = (math.cube num for num in list) #=> ... +``` |