diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-23 18:10:56 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-23 18:10:56 -0700 |
commit | b700e8e335f9e6ebf31457262db323273e339afa (patch) | |
tree | 208415a4e18a36f1073a58c1431443034f2a60c1 /cppawk-iter.1 | |
parent | 3528b08fa71d43b9541a6c56fb79bc9f95d97dd6 (diff) | |
download | cppawk-b700e8e335f9e6ebf31457262db323273e339afa.tar.gz cppawk-b700e8e335f9e6ebf31457262db323273e339afa.tar.bz2 cppawk-b700e8e335f9e6ebf31457262db323273e339afa.zip |
loop: new counting clause.
Diffstat (limited to 'cppawk-iter.1')
-rw-r--r-- | cppawk-iter.1 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cppawk-iter.1 b/cppawk-iter.1 index d55fb24..490c9cb 100644 --- a/cppawk-iter.1 +++ b/cppawk-iter.1 @@ -84,6 +84,7 @@ iter \- powerful, user-extensible iteration language for Awk \fI// calculating clauses\fP summing (\fIvar\fP, \fIexpr\fP) + counting (\fIvar\fP, \fIexpr\fP) maximizing (\fIvar\fP, \fIexpr\fP) minimizing (\fIvar\fP, \fIexpr\fP) argmax (\fImaxvar\fP, \fIarg\fP, \fIexpr\fP) @@ -787,6 +788,32 @@ ends up with the sum of the samples of the value of .I expr from before each iteration of the loop. +.SS Loop clause \fIcounting\fP +.bk +.B Syntax: + +.ft B + counting (\fIvar\fP, \fIexpr\fP) +.ft R + +.B Description + +The +.B counting +clause initialized +.I var +to zero. Prior to each iteration of the loop, +.I expr +is evaluated and if it yields a true value, then +.I var +is incremented. + +Thus, +.I var +ends up with a count of the number of iterations in which +.I expr +was true. + .SS Loop clauses \fIminimizing\fP and \fImaximizing\fP .bk .B Syntax: |