Hi,

I am taking a Ruby class online at 
https://www.codecademy.com/learn/learn-ruby and wanted to use Leo to both 
outline(organize) and run the ruby code. 

My 1st Attempt: I used one node and placed @ near the plaintext and 
@language ruby near the Ruby code. But I was unable to determine a way to 
run the code
My 2nd Attempt: I created one node named with @auto <filename>.rb  and the 
other node with the plaintext. This allowed my to auto-generate an external 
<filename>.rb file which I then ran in a bash terminal using ruby 
<filename>.rb

So using the example in the original post I wanted to know best practice 
work-flow for using Leo to outline (organize) code/plaintext and to run 
ruby code?

Thanks in advance


On Wednesday, November 1, 2017 at 3:06:16 PM UTC-4, Edward K. Ream wrote:
>
> On Wed, Nov 1, 2017 at 11:59 AM, James Gross <[email protected] 
> <javascript:>> wrote:
>
>> Let's Learn Return
>>
>> Sometimes we don't just want a method to print something to the console, 
>> but we actually want that method to hand us (or another method!) back a 
>> value. For that, we use return.
>>
>> ​​
>> def double(n)
>>   return n * 2
>> end
>>
>> output = double(6)
>> output += 2
>> puts output
>>
>>     1. In the example above, we define a new method called double that 
>> accepts one argument called n.
>>     2. Inside the method, we return two times n.
>>     3. After that, we call our new double method with an argument of 6 
>> and store the result, 12, in output.
>>     4. Then, we increase output to 14 and print it out to the console. 
>>
>
> ​In python, you would put the following in any Leo node:
>
> ​def double(n)
>   return n * 2
>
> output = double(6)
> output += 2
> print(output)  # or g.es(output)
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to