OK let’s try this.
I think Ruby (a programming language) is still pre-installed on Macs. So open Terminal and run “irb” (which stands for “interactive ruby”).
If irb doesn’t run, you’ll need to install ruby. On Mac, you can do that by installing the brew package manager then running “brew install ruby” in Terminal.
Here’s a screenshot from irb:
When you put an expression in irb, it will tell you the value of that expression. You can put in basic math and it’ll calculate it for you. A single number or string evaluates to itself. A function will evaluate to its return value.
“puts” is a function that prints a string plus a newline after and has no return value (aka returns nil). (Return value means function output.) It also accepts other data types as input and will typically do something helpful like convert them to a string then print them.
First, make sure my examples make reasonable sense to you. Look stuff up if needed.
Second, try typing some other stuff in irb. BTW you can use variables, like write “x=1+1” and then write “x+5”
Third, create a folder for working on ruby stuff in. In that folder, create a text file named hello.rb and add code to it for printing “hello world”. Navigate to that folder in Terminal and run the file with “ruby hello.rb”.
When running a ruby file, nothing is printed out automatically. If you put “3+3” on a line, ruby will just silently calculate it but won’t tell you the answer. Make and run a program that’ll calculate 3+3, save the result in a variable, and print out the value of the variable.
Also, what’s going on with the preposition “in” in my sentence “Third, create a folder for working on ruby stuff in.”? @lmd same grammar question for you too.