For cycles and exponential operator in Sonic_pi


Hi! I am starting sonic pi from scratch and so excuse me if this question sounds so banal.
I’d like to use sonic_pi for a composition, and i 'd like to have it to realize an algorithm which involves the calculation of exponential time durations with variable exponent. Remembrances of some C++ studies in the past suggested me to use the instruction for to realize the exponential calculation, but I don’t find it in the manual.
Is it possible to use it in sonic_pi? If yes, what is its syntax?
And what about the operator exponent? is there one?
Many thanks.


You can use the Ruby exponent operator **

Eg try

puts 3**2


Hi Robin! Thank you. What is Ruby? Is it something like an extra library?


Ruby is a programming language (as are Python, or Basic or Lisp amongst many others). The Sonic Pi server is written using it, although Sonic Pi also incorporates parts written in different languages. Apart from the published Sonic Pi commands, many other Ruby commands and functions can be used in Sonic Pi programs although they are not supported or guaranteed to work. The exponent operator, often signified by using two ** together is used in many languages including Ruby, and is pretty safe as a maths operator to use in Sonic Pi programs.
You can find out a bit about Ruby on the site