Content deleted Content added
Citation bot (talk | contribs) Add: title. Changed bare reference to CS1/2. | Use this bot. Report bugs. | Suggested by BrownHairedGirl | Linked from User:BrownHairedGirl/Articles_with_bare_links | #UCB_webform_linked 1161/2847 |
Matthiaspaul (talk | contribs) improved refs |
||
Line 1:
{{more citations needed|date=September 2014}}
{{use dmy dates|date=June 2022|cs1-dates=y}}
In [[computer programming]], '''ellipsis''' notation (.. or ...) is used to denote [[range (computer programming)|ranges]], an unspecified number of arguments, or a parent directory. Most programming languages require the [[ellipsis]] to be written as a series of periods; a single ([[Unicode]]) ellipsis character cannot be used.
Line 9 ⟶ 10:
In Ruby the <code>...</code> operator denotes a half-open range, i.e. that includes the start value but not the end value.
In [[Rust (programming language)|Rust]] the <code>..=</code> operator denotes an inclusive range for cases in matches and the <code>..</code> operator represents a range not including the end value.
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>
Line 40 ⟶ 41:
== Incomplete code ==
In Perl<ref>{{Cite web |
[[Python3]] also allows the 3-character ellipsis to be used as an expressive place-holder for code to be inserted later.
Line 49 ⟶ 50:
In the [[C (programming language)|C programming language]], an ellipsis is used to represent a [[variadic function|variable number of parameters]] to a [[function (programming)|function]]. For example:
:{{code|2=c|int printf( const char* format, ... );}}<ref>{{Cite web |
The above function in C could then be called with different types and numbers of parameters such as:
Line 59 ⟶ 60:
[[C99]] introduced macros with a [[variadic macro|variable number of arguments]].<ref>[https://gcc.gnu.org/onlinedocs/gcc/Variadic-Macros.html Variadic Macros - Using the GNU Compiler Collection (GCC)]</ref>
[[C++11]] included the C99 preprocessor,<ref>Working draft changes for C99 preprocessor synchronization - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm</ref> and also introduced templates with a [[variadic template|variable number of arguments]].<ref>{{cite web |
===Java===
Line 68 ⟶ 69:
===PHP===
PHP 5.6 supports<ref>{{Cite web |
<syntaxhighlight lang="php">
Line 92 ⟶ 93:
== Multiple dimensions ==
In [[Python (programming language)|Python]], particularly in [[NumPy]], an ellipsis is used for slicing an arbitrary number of dimensions for a high-dimensional array:<ref>{{Cite web |
<syntaxhighlight lang="pycon">
Line 109 ⟶ 110:
:<code>x = [ 1 2 3 4 5 6 ];</code>
In Raku an actual [[Unicode]] (U+2026) ellipsis (…) character is used to serve as a type of marker in a format string.<ref>
==References==
|