Saturday, August 4, 2007

how to play ruby language with number


how to play ruby language with number

Now that gotten everything ready, write your first program! Open your text editor, and type the following:

puts 1 + 2
puts 5 - 2
puts 3.0 + 7.0
puts 2.0 * 3.0
puts 6.0 - 9.0
puts 6.0 / 2.0
puts 3 * 2
puts 3 - 7
puts 7 / 2

your program result

3
3
10.0
6.0
-3.0
3.0
6
-4
3
you can view image how to write program in ruby language with result
Integer and float
most programming languages (and Ruby is no exception) numbers without decimal points are called integers, and numbers with decimal points are usually called floating-point numbers or, more simply, floats.

No comments: