Translate

A useful thing to do in your code is to create names for things. Sonic Pi makes this very easy: you write the name you wish to use, an equal sign (`=`), then the thing you want to remember:
SourceTranslationState
606
define :chord_player do |root, repeats|
repeats.times do
play chord(root, :minor), release: 0.3
sleep 0.5
end
end
chord_player :e3, 2
sleep 0.5
chord_player :a3, 3
chord_player :g3, 4
sleep 0.5
chord_player :e3, 3
define :chord_player do |root, repeats|
repeats.times do
play chord(root, :minor), release: 0.3
sleep 0.5
end
end
chord_player :e3, 2
sleep 0.5
chord_player :a3, 3
chord_player :g3, 4
sleep 0.5
chord_player :e3, 3
607
Here I used `repeats` as if it was a number in the line `repeats.times do`. I also used `root` as if it was a note name in my call to `play`.
Aici am folosit 'repeats' ca si cum ar fi fost un numar in linia 'repeats.times do'. De asemenea am folosit 'root' ca si cand ar fi fost numele unei note cand am apelat 'play'.
608
See how we're able to write something very expressive and easy to read by moving a lot of our logic into a function!
Iata cum am reusit sa scriem ceva foarte expresiv si usor de citit mutand o parte din cod intr-o functie!
609
5.6 Variables
5.6 Variabile
610
Variables
Variabile
611
A useful thing to do in your code is to create names for things. Sonic Pi makes this very easy: you write the name you wish to use, an equal sign (`=`), then the thing you want to remember:
Un lucru util pe care il putem face in cadrul codului nostru este sa cream nume pentru obiecte. In Sonic Pi asta se face foarte usor, scrii un nume pe care vrei sa-l folosesti, semnul egal ('='), apoi obiectul pe care vrei sa-l memorezi:
612
sample_name = :loop_amen
sample_name = :loop_amen
613
Here, we've 'remembered' the symbol `:loop_amen` in the variable `sample_name`. We can now use `sample_name` everywhere we might have used `:loop_amen`. For example:
Aici, am 'memorat' simbolul ':loop_amen' in variabila 'sample_name'. Putem folosi 'sample_name' oriunde am fi folosit ':loop_amen'. De exemplu:
614
sample_name = :loop_amen
sample sample_name
sample_name = :loop_amen
sample sample_name
615
There are three main reasons for using variables in Sonic Pi: communicating meaning, managing repetition and capturing the results of things.
Exista trei motive principale pentru utilizarea variabilelor in Sonic Pi: comunicarea rolului, gestiunea repetitiilor si stocarea rezultatului unor actiuni.
616
Communicating Meaning
Comunicarea rolului

Loading…

Loading…

Glossary

Source Translation
No related strings found in the glossary.

Source information

Source string location
05.6-Variables.md:5
Source string age
a year ago
Translation file
etc/doc/lang/sonic-pi-tutorial-ro.po, string 611
String priority
Medium