简单教程
提交运行
代码编辑器:
# !/usr/bin/ruby -w # -*- encoding:utf-8 -*- # filename: main.rb # author: 简单教程(www.twle.cn) # Copyright © 2015-2065 www.twle.cn. All rights reserved. age = 16 puts("age = #{age}") if age > 18 puts "青春年少奋斗期" elsif age <= 18 and age > 0 puts "花样年华一样的年纪" else puts "age 的值有错误" end
运行结果: