Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

how to keep real numbers in ruby

how to keep real numbers in ruby? For example, Ruby, how to keep 7.125 (real number) in memeory

1 Answer

assign it to a variable

myNumber = 7.125

then you can reference it using the name of the variable

puts("The number is #{myNumber}")

Ok I understand it we can keep data as variable. (Sorry for bad Englih) I have exam about program languages. My language is Ruby as you can see. The question is "How is kept real numbers in your language? Show 7.125 real number in your memory." There is not much source about it. I'm confusing, ruby may be keep data as binary. I can't understand memory things. I hope I could explain my situation.