Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.57 KB | None | 0 0
  1. irb(main):001:0> puts 'Buenos Dias Lore'
  2. Buenos Dias Lore
  3. => nil
  4. irb(main):002:0> ^C
  5. irb(main):002:0> 'Buenos dias Lore'
  6. => "Buenos dias Lore"
  7. irb(main):003:0>
  8. irb(main):004:0* composer = mozart
  9. NameError: undefined local variable or method `mozart' for main:Object
  10. from (irb):4
  11. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  12. irb(main):005:0> composer = 'mozart'
  13. => "mozart"
  14. irb(main):006:0> puts composer + was a "da bomb" in his day.'
  15. irb(main):007:0' ^C
  16. irb(main):007:0> composer = 'Mozart'
  17. => "Mozart"
  18. irb(main):008:0> puts composer +'was "da bomb" in his day.'
  19. Mozartwas "da bomb" in his day.
  20. => nil
  21. irb(main):009:0> puts horas del dia = '365*24'
  22. NoMethodError: undefined method `del' for main:Object
  23. from (irb):9
  24. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  25. irb(main):010:0> puts horas_del_dia = 365*24
  26. 8760
  27. => nil
  28. irb(main):011:0> puts horas_del_dia
  29. 8760
  30. => nil
  31. irb(main):012:0> puts 'Horas anuales' + horas_del_dia
  32. TypeError: no implicit conversion of Integer into String
  33. from (irb):12:in `+'
  34. from (irb):12
  35. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  36. irb(main):013:0> horas_del dia = '365*24'
  37. NoMethodError: undefined method `horas_del' for main:Object
  38. from (irb):13
  39. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  40. irb(main):014:0> horas_del_dia = '365*24'
  41. => "365*24"
  42. irb(main):015:0> horas_del_dia = 365*24
  43. => 8760
  44. irb(main):016:0>
  45. irb(main):017:0* horas_del_dia + 'resultado'
  46. TypeError: String can't be coerced into Integer
  47. from (irb):17:in `+'
  48. from (irb):17
  49. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  50. irb(main):018:0> puts 'Resultado' + horas_del_dia
  51. TypeError: no implicit conversion of Integer into String
  52. from (irb):18:in `+'
  53. from (irb):18
  54. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  55. irb(main):019:0> puts horas_del_dia.toS
  56. NoMethodError: undefined method `toS' for 8760:Integer
  57. Did you mean? to_s
  58. from (irb):19
  59. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  60. irb(main):020:0>
  61. irb(main):021:0* puts horas_del_dia.to_s
  62. 8760
  63. => nil
  64. irb(main):022:0>
  65. irb(main):023:0* var1=2
  66. => 2
  67. irb(main):024:0> var2='5'
  68. => "5"
  69. irb(main):025:0> puts var1.to_s + var2
  70. 25
  71. => nil
  72. irb(main):026:0> puts 'Horas del dia =' + horas_del_dia
  73. TypeError: no implicit conversion of Integer into String
  74. from (irb):26:in `+'
  75. from (irb):26
  76. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  77. irb(main):027:0> horas_del_dia
  78. => 8760
  79. irb(main):028:0> puts 'Horas anuales=' + horas_del-dia.to_s
  80. NameError: undefined local variable or method `horas_del' for main:Object
  81. Did you mean? horas_del_dia
  82. from (irb):28
  83. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  84. irb(main):029:0> var1=2
  85. => 2
  86. irb(main):030:0> var2='5
  87. irb(main):031:0' Var2='5'
  88. irb(main):032:0' puts var2.to_i + Var1
  89. irb(main):033:0'
  90. irb(main):034:0'
  91. irb(main):035:0' ^C
  92. irb(main):035:0> puts var1
  93. 2
  94. => nil
  95. irb(main):036:0> var2='5'
  96. => "5"
  97. irb(main):037:0> puts var2.to_i + var1
  98. 7
  99. => nil
  100. irb(main):038:0> puts'Horas anuales' + horas_del_dia.to_s
  101. Horas anuales8760
  102. => nil
  103. irb(main):039:0> puts'Horas anuales = 'horas_del_dia.to_s
  104. SyntaxError: (irb):39: syntax error, unexpected tIDENTIFIER, expecting end-of-input
  105. Horas anuales = 'horas_del_dia.to_s
  106. ^
  107. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  108. irb(main):040:0> puts'Horas anuales= ' +horas_del_dia.to_s
  109. Horas anuales= 8760
  110. => nil
  111. irb(main):041:0> puts '15.to_f
  112. irb(main):042:0' ^C
  113. irb(main):042:0> puts'15'.to_f
  114. 15.0
  115. => nil
  116. irb(main):043:0> puts'99.999'.to_f
  117. 99.999
  118. => nil
  119. irb(main):044:0> puts'99.999'.to_i
  120. 99
  121. => nil
  122. irb(main):045:0> puts ' '
  123.  
  124. => nil
  125. irb(main):046:0> puts'5 is my favorite number'.to_i
  126. 5
  127. => nil
  128. irb(main):047:0> puts'Who asked you about 5?'.to_i
  129. 0
  130. => nil
  131. irb(main):048:0> puts 3.to_i
  132. 3
  133. => nil
  134. irb(main):049:0>
  135. irb(main):050:0* puts gets
  136. is there an echo here?
  137. is there an echo here?
  138. => nil
  139. irb(main):051:0> is there an echo here?
  140. NoMethodError: undefined method `here?' for main:Object
  141. from (irb):51
  142. from C:/Ruby24/bin/irb.cmd:19:in `<main>'
  143. irb(main):052:0> puts gets
  144. Unbreakable
  145. Unbreakable
  146. => nil
  147. irb(main):053:0> puts 'Hello there, and what\'s your name?'
  148. Hello there, and what's your name?
  149. => nil
  150. irb(main):054:0> name = gets
  151. puts 'Your name is ' + name + '? What a lovely name!'
  152. => "puts 'Your name is ' + name + '? What a lovely name!'\n"
  153. irb(main):055:0> puts 'pleased to meet you, ' + name + '.
  154. irb(main):056:0' ^C
  155. irb(main):056:0> puts 'Hello There, and what\'s your name?'
  156. Hello There, and what's your name?
  157. => nil
  158. irb(main):057:0> name = gets.chomp
  159. puts 'Your name is' + name + '? What a lovely name!'
  160. => "puts 'Your name is' + name + '? What a lovely name!'"
  161. irb(main):058:0>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement