ruby学习_2
来源:互联网 发布:网络调研平台 编辑:程序博客网 时间:2024/06/10 12:41
=begin变量:局部变量:以小写字母或者'_'起始的变量全局变量:以‘$’起始的变量实例变量:以'@'起始的变量类变量: 以'@@'起始的变量虚拟变量:”true“,"false","self"等特定名称的变量unless语句:unless condition thenactend与if相反etc.->a = 10 b = 20 unless a > b puts "execute here!" end output: execute here!case 语句:case 比较的对象when value1 thenact1when value2 then act2elseact3enduntil 语句:sum = 0i = 1 until sum >= 50sum+=ii += 1 end=endi = 0['gao','shang','bo','for','test'].each{|str| i += 1 if(i == 3) break end p [i,str]}#another sample=begin continue ?=endi = 0['gao','shang','bo','for','test'].each{|str| i += 1 if(i == 3) next end p [i,str]}#the third sample=begin redo 再次执行当前语句,即执行i += 1=endi = 0['gao','shang','bo','for','test'].each{|str| i += 1 if(i == 3) redo end p [i,str]}
0 0
- ruby学习_2
- JavaScript 学习_2
- vi学习_2模式
- java学习_2.数据类型
- Block阶梯学习_2
- Swift学习笔记_2
- autolayout学习笔记_2
- EasyUI学习笔记_2
- swift学习03_2
- Retrofit2学习项目_2
- Linux操作系统学习_2
- PS学习_2-选区
- Angular2学习_2(表单)
- pytorch学习_2
- python学习_2
- ZigBee学习笔记_InitBoard()_2
- ZigBee学习笔记_HalDriverInit()_2
- 18_2学习辅助软件
- 让python代码运行的更快
- 剑指offer之寻找丑数,待字闺中之序列生成分析
- ORCFile存储格式
- .net 3.5 HttpRequest 请求的url 网址 如何实现不转义
- 网络编程浅析(二)
- ruby学习_2
- 【已解决】 java.security.KeyStoreException: java.security.NoSuchAlgorithmException
- C++技术问题总结-第2篇 进程通信
- dell 笔记本 ubuntu 安装 无线网卡驱动(Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter)
- 时间管理-读文笔记-番茄时间管理法(Pomodoro Technique)
- Android 最火的快速开发框架XUtils
- CAS Server改造
- 华为机试题(二)
- Android自绘字体大小paint.settextsize随分辨率大小变化