猿问
下载APP

ruby怎么实现数组减法?

ruby怎么实现数组减法


慕姐5112350
浏览 180回答 1
1回答

慕雪9262066

数组的创建和初始化a = Array.[](1,2,3,4)b = Array[1,2,3,4]c = [1,2,3,4]d = Array.new #创建一个空数组e = Array.new(3) #[nil,nil,nil] 初始大小3f = Array.new(3,"xx") #["xx","xx","xx"] 初始大小3 初始值"xx"f[0].capitalize! #=> ["Xx","Xx","Xx"]g = Array.new(3){"yy"} #=> ["yy","yy","yy"]g[0].capitalize! #=>["Yy","yy","yy"]
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Ruby
我要回答