IMP1 Ruby Tutorial
3 posters
OmegaDev :: Coding Plaza :: RGSS2 (VX) :: RGSS2 Tutorials
Page 1 of 1
IMP1 Ruby Tutorial
First off, download the Ruby Installer. It'll allow you to try out ruby by yourself.
Ruby Tutorial III - Variables
Ruby Tutorial III - Variables
Things to know:
The puts method prints the following object as a string. Consider it to be short for 'Put Srting'.
Imagine a world where you could store a massive object (a number or a string and others not yet discorvered) in one word. Well, it's your lucky day. 'Cos that's excatly what a variable is.
One thing to remember, and that's that a variable starts with a lower-case letter, or an underscore.
- Code:
my_first_variable = "The longest string in the whole wide world ever seen by a mortal other than that one mortal that saw that one string that time... but let's not go into that now, because it's a distraction from the main point, which is that this is a long string that nobody wants to type more than once."
Input:
- Code:
name = "IMP1"
puts "hi " + name + "."
- Code:
"hi IMP1."
Input:
- Code:
variable1 = 10
variable2 = 1.5
puts variable1 * (variable2 + 1)
- Code:
"25"
Input:
- Code:
a = 10
b = a
puts a
puts b
puts ''
a = 5
puts a
puts b
- Code:
"10"
"10"
"5"
"10"
Now, wasn't that easy? A short topic because there's so little to say about variable. They're just so darn simple.
Homework:
Practise, practise, practise.
Good Hunting.
NEXT TIME: Methods.
Last edited by IMP1 on Thu Jul 15, 2010 12:21 pm; edited 1 time in total
IMP1- Coding Moderator
- Posts : 503
Gald : 1399
Stats
Cookies: 5
Re: IMP1 Ruby Tutorial
That is pretty good. I'm not good at explaining stuff but you make it pretty simple =D
Re: IMP1 Ruby Tutorial
Pure Awesomeness IMP. Thanks for posting this.
crazedanimekid- Platinum Cookiez
- Posts : 501
Gald : 1277
Stats
Cookies: 0
OmegaDev :: Coding Plaza :: RGSS2 (VX) :: RGSS2 Tutorials
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|