ruby中require load include的区别

load: loads a source file every time it is called.每次加载文件的时候都调用

require: loads a source file only once.第一次加载文件的时候调用

include: includes modules,nothing to do with files.加载modules时用,与文件无关.


chomp: removes any line ending ("\n", "\r", "\r\n")

chop: would remove ANY final character (chomp is usually better) 

print: outputs a string with no line return
puts: outputs a string with a line return


# Use gets inside a loop for more user input

1 result = ""
2 until result == "quit"
3   print "> "
4   result = gets.chomp
5   puts "I heard: #{result}"
6 end
7 puts "Goodbye!"

原文地址:https://www.cnblogs.com/rowdawn/p/3118078.html