Learning Perl: 10.2. The until Control Structure
来源:互联网 发布:添加打印机无usb端口 编辑:程序博客网 时间:2024/06/10 14:47
10.2. The until Control Structure
Sometimes, you'll want to reverse the condition of a while loop. To do that, use until:
until ($j > $i) { $j *= 2; }
This loop runs until the conditional expression returns true. It's really just a while loop in disguise, except it repeats as long as the conditional is false, rather than true. The conditional expression is evaluated before the first iteration, so this is a zero-or-more-times loop, just like the while loop.[*] As with if and unless, you could rewrite any until loop to become a while loop by negating the condition. But generally, you'll find it simple and natural to use until from time to time.
[*] Pascal programmers, take note: in Pascal, the repeat-until always runs at least one iteration, but an until loop in Perl may not run at all if the conditional expression is true before the loop starts.
- Learning Perl: 10.2. The until Control Structure
- Perl Learning: 2.6. The if Control Structure
- Perl Learning: 2.9. The while Control Structure
- Learning Perl: 3.6. The foreach Control Structure
- Learning Perl: 10.1. The unless Control Structure
- Learning Perl: 10.4. The Naked Block Control Structure
- Learning Perl: 2.8. The chomp Operator
- Perl Learning: 2.10. The undef Value
- Learning Perl: 2.11. The defined Function
- Learning Perl: 4.8. The use strict Pragma
- Learning Perl: 4.9. The return Operator
- Learning Perl: 5.3. The Invocation Arguments
- Learning Perl: 8.4. The Binding Operator, =~
- Learning Perl: 8.6. The Match Variables
- Learning Perl: 9.2. The split Operator
- Learning Perl: 9.3. The join Function
- Learning Perl: 10.5. The elsif Clause
- shell Learning [ until 的用法]
- java Script查询列表排序
- Learning Perl: 9.5. More Powerful Regular Expressions
- Learning Perl: 10.1. The unless Control Structure
- 重置cdr的billsec的方法
- 飞秋_飞秋2010_飞秋2010下载_飞秋下载2010正式版
- Learning Perl: 10.2. The until Control Structure
- Learning Perl: 10.3. Expression Modifiers
- Learning Perl: 10.4. The Naked Block Control Structure
- Learning Perl: 10.5. The elsif Clause
- Learning Perl: 10.6. Autoincrement and Autodecrement
- ASP.NET中Response.Redirect()方法深度剖析(转)
- 一些学习prestashop的好网站
- Scite配置
- jfreechart实例