mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
Add while(cond; update) (fix #314)
This commit is contained in:
@@ -958,6 +958,11 @@ static const char* const jq_builtins[] = {
|
||||
" def _range: "
|
||||
" if (by > 0 and . < upto) or (by < 0 and . > upto) then ., ((.+by)|_range) else . end; "
|
||||
" if by == 0 then init else init|_range end | select((by > 0 and . < upto) or (by < 0 and . > upto));",
|
||||
// generic iterator/generator
|
||||
"def while(cond; update): "
|
||||
" def _while: "
|
||||
" if cond then ., (update | _while) else empty end; "
|
||||
" _while;",
|
||||
};
|
||||
#undef LIBM_DD
|
||||
|
||||
|
||||
Reference in New Issue
Block a user