Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- irb(main):001:0> puts 'Buenos Dias Lore'
- Buenos Dias Lore
- => nil
- irb(main):002:0> ^C
- irb(main):002:0> 'Buenos dias Lore'
- => "Buenos dias Lore"
- irb(main):003:0>
- irb(main):004:0* composer = mozart
- NameError: undefined local variable or method `mozart' for main:Object
- from (irb):4
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):005:0> composer = 'mozart'
- => "mozart"
- irb(main):006:0> puts composer + was a "da bomb" in his day.'
- irb(main):007:0' ^C
- irb(main):007:0> composer = 'Mozart'
- => "Mozart"
- irb(main):008:0> puts composer +'was "da bomb" in his day.'
- Mozartwas "da bomb" in his day.
- => nil
- irb(main):009:0> puts horas del dia = '365*24'
- NoMethodError: undefined method `del' for main:Object
- from (irb):9
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):010:0> puts horas_del_dia = 365*24
- 8760
- => nil
- irb(main):011:0> puts horas_del_dia
- 8760
- => nil
- irb(main):012:0> puts 'Horas anuales' + horas_del_dia
- TypeError: no implicit conversion of Integer into String
- from (irb):12:in `+'
- from (irb):12
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):013:0> horas_del dia = '365*24'
- NoMethodError: undefined method `horas_del' for main:Object
- from (irb):13
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):014:0> horas_del_dia = '365*24'
- => "365*24"
- irb(main):015:0> horas_del_dia = 365*24
- => 8760
- irb(main):016:0>
- irb(main):017:0* horas_del_dia + 'resultado'
- TypeError: String can't be coerced into Integer
- from (irb):17:in `+'
- from (irb):17
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):018:0> puts 'Resultado' + horas_del_dia
- TypeError: no implicit conversion of Integer into String
- from (irb):18:in `+'
- from (irb):18
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):019:0> puts horas_del_dia.toS
- NoMethodError: undefined method `toS' for 8760:Integer
- Did you mean? to_s
- from (irb):19
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):020:0>
- irb(main):021:0* puts horas_del_dia.to_s
- 8760
- => nil
- irb(main):022:0>
- irb(main):023:0* var1=2
- => 2
- irb(main):024:0> var2='5'
- => "5"
- irb(main):025:0> puts var1.to_s + var2
- 25
- => nil
- irb(main):026:0> puts 'Horas del dia =' + horas_del_dia
- TypeError: no implicit conversion of Integer into String
- from (irb):26:in `+'
- from (irb):26
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):027:0> horas_del_dia
- => 8760
- irb(main):028:0> puts 'Horas anuales=' + horas_del-dia.to_s
- NameError: undefined local variable or method `horas_del' for main:Object
- Did you mean? horas_del_dia
- from (irb):28
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):029:0> var1=2
- => 2
- irb(main):030:0> var2='5
- irb(main):031:0' Var2='5'
- irb(main):032:0' puts var2.to_i + Var1
- irb(main):033:0'
- irb(main):034:0'
- irb(main):035:0' ^C
- irb(main):035:0> puts var1
- 2
- => nil
- irb(main):036:0> var2='5'
- => "5"
- irb(main):037:0> puts var2.to_i + var1
- 7
- => nil
- irb(main):038:0> puts'Horas anuales' + horas_del_dia.to_s
- Horas anuales8760
- => nil
- irb(main):039:0> puts'Horas anuales = 'horas_del_dia.to_s
- SyntaxError: (irb):39: syntax error, unexpected tIDENTIFIER, expecting end-of-input
- Horas anuales = 'horas_del_dia.to_s
- ^
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):040:0> puts'Horas anuales= ' +horas_del_dia.to_s
- Horas anuales= 8760
- => nil
- irb(main):041:0> puts '15.to_f
- irb(main):042:0' ^C
- irb(main):042:0> puts'15'.to_f
- 15.0
- => nil
- irb(main):043:0> puts'99.999'.to_f
- 99.999
- => nil
- irb(main):044:0> puts'99.999'.to_i
- 99
- => nil
- irb(main):045:0> puts ' '
- => nil
- irb(main):046:0> puts'5 is my favorite number'.to_i
- 5
- => nil
- irb(main):047:0> puts'Who asked you about 5?'.to_i
- 0
- => nil
- irb(main):048:0> puts 3.to_i
- 3
- => nil
- irb(main):049:0>
- irb(main):050:0* puts gets
- is there an echo here?
- is there an echo here?
- => nil
- irb(main):051:0> is there an echo here?
- NoMethodError: undefined method `here?' for main:Object
- from (irb):51
- from C:/Ruby24/bin/irb.cmd:19:in `<main>'
- irb(main):052:0> puts gets
- Unbreakable
- Unbreakable
- => nil
- irb(main):053:0> puts 'Hello there, and what\'s your name?'
- Hello there, and what's your name?
- => nil
- irb(main):054:0> name = gets
- puts 'Your name is ' + name + '? What a lovely name!'
- => "puts 'Your name is ' + name + '? What a lovely name!'\n"
- irb(main):055:0> puts 'pleased to meet you, ' + name + '.
- irb(main):056:0' ^C
- irb(main):056:0> puts 'Hello There, and what\'s your name?'
- Hello There, and what's your name?
- => nil
- irb(main):057:0> name = gets.chomp
- puts 'Your name is' + name + '? What a lovely name!'
- => "puts 'Your name is' + name + '? What a lovely name!'"
- irb(main):058:0>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement