掃碼下載編程獅APP
#!/usr/bin/ruby # -*- coding: UTF-8 -*- score = 70 result = case score when 0..40 "糟糕的分數(shù)" when 41..60 "快要及格" when 61..70 "及格分數(shù)" when 71..100 "良好分數(shù)" else "錯誤的分數(shù)" end puts result