HOME

TheInfoList



OR:

In computer programming, ellipsis notation (.. or ...) is used to denote
ranges In the Hebrew Bible and in the Old Testament, the word ranges has two very different meanings. Leviticus In Leviticus 11:35, ranges probably means a cooking furnace for two or more pots, as the Hebrew word here is in the dual number; or perhaps ...
, 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.


Ranges

In some programming languages (including Ada, Perl, Ruby, Apache Groovy, Kotlin, Haskell, and
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, Fren ...
), a shortened two-dot ellipsis is used to represent a range of values given two endpoints; for example, to iterate through a list of integers between 1 and 100 inclusive in Perl: :foreach (1..100) In Ruby the ... operator denotes a half-open range, i.e. that includes the start value but not the end value. In Rust the ..= operator denotes an inclusive range for cases in matches and the .. operator represents a range not including the end value. Perl and Ruby overload the ".." operator in scalar context as a
flip-flop operator In computer programming, a flip-flop is a seldom-used syntactic construct which allows a boolean to flip from false to true when a first condition is met and then back to false when a second condition is met. The syntax is available in the programm ...
- a
stateful In information technology and computer science, a system is described as stateful if it is designed to remember preceding events or user interactions; the remembered information is called the state of the system. The set of states a system can oc ...
bistable
Boolean Any kind of logic, function, expression, or theory based on the work of George Boole is considered Boolean. Related to this, "Boolean" may refer to: * Boolean data type, a form of data with only two possible values (usually "true" and "false" ...
test, roughly equivalent to "true while ''x'' but not yet ''y''", similarly to the "," operator in sed and AWK.
GNU C The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free software ...
compatible compilers have an extension to the C and C++ language to allow ''case ranges'' in
switch statement In computer programming languages, a switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via search and map. Switch statements function some ...
s: switch(u) Additionally, GNU C allows a similar range syntax for designated initializers, available in the C language only: int array 0= ; Delphi / Turbo Pascal / Free Pascal: var FilteredChars: set of 0..#32,#127,'a'..'z' var CheckedItems: set of ,10..38,241,58 In the Unified Modeling Language (UML), a two-character ellipsis is used to indicate variable cardinality of an association. For example, a cardinality of 1..* means that the number of elements aggregated in an association can range from 1 to infinity (a usage equivalent to Kleene plus).


Parent directory

On Windows and Unix-like operating systems, ".." is used to access the parent directory in a path.


Incomplete code

In Perl and Raku the 3-character ellipsis is also known as the "yada yada yada" operator and, similarly to its linguistic meaning, serves as a "stand-in" for code to be inserted later. Python3 also allows the 3-character ellipsis to be used as an expressive place-holder for code to be inserted later.


Variable number of parameters


C and C++

In the
C programming language ''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as ...
, an ellipsis is used to represent a variable number of parameters to a function. For example: : The above function in C could then be called with different types and numbers of parameters such as: : and : C99 introduced macros with a variable number of arguments. C++11 included the C99 preprocessor, and also introduced templates with a variable number of arguments.


Java

As of version 1.5, Java has adopted this "varargs" functionality. For example: :


PHP

PHP 5.6 supports use of ellipsis to define an explicitly variadic function, where ... before an argument in a function definition means that arguments from that point on will be collected into an array. For example: function variadic_function($a, $b, ...$other) var_dump(variadic_function(1, 2, 3, 4, 5)); Produces this output: array(3)


Multiple dimensions

In Python, particularly in NumPy, an ellipsis is used for slicing an arbitrary number of dimensions for a high-dimensional array: >>> import numpy as np >>> t = np.random.rand(2, 3, 4, 5) >>> t .., 0shape # select 1st element from last dimension, copy rest (2, 3, 4) >>> t , ...shape # select 1st element from first dimension, copy rest (3, 4, 5)


Other semantics

In MATLAB, a three-character ellipsis is used to indicate
line continuation This comparison of programming languages compares the features of language syntax (format) for over 50 computer programming languages. Expressions Programming language expressions can be broadly classified into four syntax structures: ;pre ...
, making the sequence of lines :x = 1 2 3 ...
4 5 6
semantically equivalent to the single line :x =
1 2 3 4 5 6 1 (one, unit, unity) is a number representing a single or the only entity. 1 is also a numerical digit and represents a single unit of counting or measurement. For example, a line segment of ''unit length'' is a line segment of length 1. I ...
In Raku an actual Unicode (U+2026) ellipsis (…) character is used to serve as a type of marker in a format string.


References

{{reflist Operators (programming)