Roshan Book

My Tech Notebook

Learning Ruby Part 8–Variables


We can create Methods that don’t belong to any class.

Declaring a common method

def crap

puts “I am a crappy crap”

end

Calling Method directly

crap

 

Adding value to variable

man=”manish”

 

Few things to keep in mind

A variable should start with letters or _ .

No spaces allowed

No symbols like %

Variables are case sensitive

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: