def say_goodnight(name)
  result ="Good night ." +name
  return result
end

def say_goodmorning(name)
  result ="Good morning .#{name}" 
  return result
end

def say_goodafternoon(name)
  result ="Good afternoon .#{name}" 
end


puts say_goodnight("jake")

puts say_goodmorning("heidsoft")

puts say_goodafternoon("heidcloud")

a =[1,'cat',3.14]
a[0]=nil
puts a

b=%w{jake heidsoft heidcloud}

#散列 =>左边是建,右边是值
cloud_system={
    'java' => 'CloudStack',
    'Python' =>'OpenStack',
    'c/c++' =>'OpenNebula'
}

puts cloud_system['java']
puts cloud_system['Python']

count=1
tries=2
if count>3
  puts 'java'
elsif tries=3
  puts 'python'
else
  puts 'c/c++'
end
weight=0
hight=100
# while weight <100 and hight<=200
#   count+=1
# end
#
puts count
while line=gets
  puts line.downcase
end

#nil=false
if count>100
  puts "count > 100"
end
#这种写法和上面的一样
puts "count > 100" if count>100

square =2
while square <1000
  square=square*square
end

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-10
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2021-08-27
猜你喜欢
  • 2022-12-23
  • 2021-12-13
  • 2021-10-04
  • 2021-10-07
  • 2021-09-13
  • 2021-06-07
  • 2021-11-30
相关资源
相似解决方案