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