Content deleted Content added
→Ranges: designated initializers in C |
|||
Line 13:
Perl and Ruby [[Operator overloading|overload]] the ".." operator in scalar context as a [[flip-flop operator]] - a [[stateful]] [[bistability|bistable]] [[Boolean datatype|Boolean]] test, roughly equivalent to "true while ''x'' but not yet ''y''", similarly to the "," operator in [[Sed (programming language)|sed]] and [[AWK programming language|AWK]].<ref>[http://perldoc.perl.org/perlop.html#Range-Operators-operator%2c-range-range-..-... perlop - perldoc.perl.org<!-- Bot generated title -->]</ref>
<syntaxhighlight lang="C">
switch(u) {
Line 21:
default: error("not supported!");
}
</syntaxhighlight>
Additionally, GNU C allows a similar range syntax for [[C syntax#Designated initializers|designated initializers]], available in the C language only:
<syntaxhighlight lang="C">
int array[10] = { [0...5] = 1 };
</syntaxhighlight>
|