⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 00 - introduction

📁 O Reilly Ruby Cookbook source code
💻
字号:
hash = { "key1" => "val1", "key2" => "val2" }string = ""hash.each { |k,v| string << "#{k} is #{v}\n" } puts string# key1 is val1# key2 is val2#---string = ""hash.each { |k,v| string << k << " is " << v << "\n" } #---puts hash.keys.join("\n") + "\n"# key1# key2#---data = ['1', '2', '3']s = ''data.each { |x| s << x << ' and a '}s                                             # => "1 and a 2 and a 3 and a "data.join(' and a ')                          # => "1 and a 2 and a 3"#---s = ""data.each_with_index { |x, i| s << x; s << "|" if i < data.length-1 }s                                             # => "1|2|3"#---

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -