a=[1,'cat',3.14] #有三个元素的数组 #访问第一个元素 a[0] -> 1 #设置第三个元素 a[2] = nil #显示这个数组 a ->[1,'cat',nil]
a = ['ant','bee','cat','dog','elk']
a[0] -> "ant"
a[3] -> "dog"
#this is the same:
a = %w{ant bee cat dog elk}
a[0] -> "ant"
a[3] -> "dog"
inst_section = {
'cello' => 'string',
'clarinet' => 'woodwind',
'drum' => 'percussion',
'oboe' => 'woodwind',
'trumpet' => 'brass',
'violin' => 'string'
}
inst_section['oboe'] -> "woodwind" inst_section['cello'] -> "string" inst_section['bassoon'] -> nil
histogram = Hash.new(0) histogram['key1'] ->0 histogram['key1'] = histogram['key1']+1 histogram['key1'] ->1
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有