From dc235b3d13c1c7a3a11585dcce8adf992bf707f6 Mon Sep 17 00:00:00 2001 From: tricinel Date: Tue, 20 Oct 2015 10:18:08 +0200 Subject: [coffeescript/en] Add coffeescript translation to Romanian --- ro-ro/coffeescript-ro.html.markdown | 101 ++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 ro-ro/coffeescript-ro.html.markdown (limited to 'ro-ro') diff --git a/ro-ro/coffeescript-ro.html.markdown b/ro-ro/coffeescript-ro.html.markdown new file mode 100644 index 00000000..ece502a0 --- /dev/null +++ b/ro-ro/coffeescript-ro.html.markdown @@ -0,0 +1,101 @@ +--- +language: coffeescript +contributors: + - ["Tenor Biel", "http://github.com/L8D"] + - ["Xavier Yao", "http://github.com/xavieryao"] +translators: + - ["Bogdan Lazar", "http://twitter.com/tricinel"] +filename: coffeescript.coffee +--- + +CoffeeScript este un limbaj de programare care este compilat in Javascript. Nu exista un interpretator la runtime-ul aplicatiei. Fiind unul din successorii Javascript, CoffeeScript incearca sa compileze Javascript usor de citit si performant. + +Mai cititi si [website-ul CoffeeScript](http://coffeescript.org/), care contine un tutorial complet Coffeescript. + +```coffeescript +# CoffeeScript este un limbaj de hipster. +# Se foloseste de trendurile multor limbaje moderne de programare. +# Comentarii sunt ca in Ruby sau Python. + +### +Comentariile in bloc sunt create cu `###`, iar acestea sunt transformate in `/*` si `*/` pentru Javascript + +Ar trebuie sa intelegeti Javascript pentru a continua cu acest ghid. +### + +# Atribuirea valorilor: +numar = 42 #=> var numar = 42; +opus = true #=> var opus = true; + +# Conditii: +numar = -42 if opus #=> if(opus) { numar = -42; } + +# Functii: +laPatrat = (x) -> x * x #=> var laPatrat = function(x) { return x * x; } + +plin = (recipient, lichid = "cafea") -> + "Umplem #{recipient} cu #{cafea}..." +#=>var plin; +# +#plin = function(recipient, lichid) { +# if (lichid == null) { +# lichid = "cafea"; +# } +# return "Umplem " + recipient + " cu " + lichid + "..."; +#}; + +# Liste: +lista = [1..5] #=> var lista = [1, 2, 3, 4, 5]; + +# Obiecte: +matematica = + radacina: Math.sqrt + laPatrat: laPatrat + cub: (x) -> x * square x +#=> var matematica = { +# "radacina": Math.sqrt, +# "laPatrat": laPatrat, +# "cub": function(x) { return x * square(x); } +# }; + +# Splats: +cursa = (castigator, alergatori...) -> + print castigator, alergatori +#=>cursa = function() { +# var alergatori, castigator; +# castigator = arguments[0], alergatori = 2 <= arguments.length ? __slice.call(arguments, 1) : []; +# return print(castigator, alergatori); +# }; + +# Verificarea existentei: +alert "Stiam eu!" if elvis? +#=> if(typeof elvis !== "undefined" && elvis !== null) { alert("Stiam eu!"); } + +# Operatiuni cu matrice: +cuburi = (math.cube num for num in list) +#=>cuburi = (function() { +# var _i, _len, _results; +# _results = []; +# for (_i = 0, _len = list.length; _i < _len; _i++) { +# num = list[_i]; +# _results.push(math.cube(num)); +# } +# return _results; +# })(); + +alimente = ['broccoli', 'spanac', 'ciocolata'] +mananca aliment for aliment in alimente when aliment isnt 'ciocolata' +#=>alimente = ['broccoli', 'spanac', 'ciocolata']; +# +#for (_k = 0, _len2 = alimente.length; _k < _len2; _k++) { +# aliment = alimente[_k]; +# if (aliment !== 'ciocolata') { +# eat(aliment); +# } +#} +``` + +## Resurse aditionale + +- [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/) +- [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read) -- cgit v1.2.3