条件控制 本人喜欢用程序demo记录的方式来记录某方法的使用,如times方法,仅作个人学习记录 #--------------if语句(相反是unless)而while相同于until-------------- print "--------------if------------------------ ps: in ruby,the symbol ','just works as plusing string\n" x = 0 if x==0 then end p "…
条件判断:if语句 语法格式: if [ expression ] then Statement(s) to be executed if expression is true fi 注意:expression 和方括号([ ])之间必须有空格,否则会有语法错误. if 语句通过关系运算符判断表达式的真假来决定执行哪个分支.Shell 有三种 if ... else 语句: if ... fi 语句 if ... else ... fi 语句 if ... elif ... else ... f…