Roshan Book

My Tech Notebook

Learning Ruby Part 12 Changing data type and Declaring constant


c=13 (here c has a integer value)

c.to_f – This changes c data type to float

This type of data changing is called Casting

Similarly for strings

num = 10
num.to_s => “10”

Declaring a constant

Start with capital letter. Like Variable=10

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: