Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
9
Task/User-input-Text/Ruby/user-input-text.rb
Normal file
9
Task/User-input-Text/Ruby/user-input-text.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
print "Enter a string: "
|
||||
s = gets
|
||||
printf "Enter an integer: "
|
||||
i = gets.to_i # If string entered, will return zero
|
||||
printf "Enter a real number: "
|
||||
f = Float(gets) rescue nil # converts a floating point number or returns nil
|
||||
puts "String = #{s}"
|
||||
puts "Integer = #{i}"
|
||||
puts "Float = #{f}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue