HOME

TheInfoList



OR:

In
computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as anal ...
, 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 The ellipsis (, also known informally as dot dot dot) is a series of dots that indicates an intentional omission of a word, sentence, or whole section from a text without altering its original meaning. The plural is ellipses. The term origin ...
to be written as a series of periods; a single (
Unicode Unicode, formally The Unicode Standard,The formal version reference is is an information technology standard for the consistent encoding, representation, and handling of text expressed in most of the world's writing systems. The standard, wh ...
) ellipsis character cannot be used.


Ranges

In some
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
s (including
Ada Ada may refer to: Places Africa * Ada Foah, a town in Ghana * Ada (Ghana parliament constituency) * Ada, Osun, a town in Nigeria Asia * Ada, Urmia, a village in West Azerbaijan Province, Iran * Ada, Karaman, a village in Karaman Province, ...
,
Perl Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offic ...
,
Ruby A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called ...
,
Apache Groovy Apache Groovy is a Java-syntax-compatible object-oriented programming language for the Java platform. It is both a static and dynamic language with features similar to those of Python, Ruby, and Smalltalk. It can be used as both a programming lan ...
, Kotlin,
Haskell Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lan ...
, and Pascal), a shortened two-dot ellipsis is used to represent a range of values given two endpoints; for example, to iterate through a list of
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
s 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 Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO( ...
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 - a stateful bistable Boolean test, roughly equivalent to "true while ''x'' but not yet ''y''", similarly to the "," operator in
sed sed ("stream editor") is a Unix utility that parses and transforms text, using a simple, compact programming language. It was developed from 1973 to 1974 by Lee E. McMahon of Bell Labs, and is available today for most operating systems. sed w ...
and
AWK AWK (''awk'') is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter, and is a standard feature of most Unix-like operating systems. The AWK lang ...
. GNU C compatible compilers have an extension to the C and C++ language to allow ''case ranges'' in switch statements: 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 The Unified Modeling Language (UML) is a general-purpose, developmental modeling language in the field of software engineering that is intended to provide a standard way to visualize the design of a system. The creation of UML was originally m ...
(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 In mathematical logic and computer science, the Kleene star (or Kleene operator or Kleene closure) is a unary operation, either on sets of strings or on sets of symbols or characters. In mathematics, it is more commonly known as the free monoid ...
).


Parent directory

On Windows and Unix-like operating systems, ".." is used to access the parent directory in a
path A path is a route for physical travel – see Trail. Path or PATH may also refer to: Physical paths of different types * Bicycle path * Bridle path, used by people on horseback * Course (navigation), the intended path of a vehicle * Desire p ...
.


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 Semantics (from grc, σημαντικός ''sēmantikós'', "significant") is the study of reference, meaning, or truth. The term can be used to refer to subfields of several distinct disciplines, including philosophy, linguistics and comput ...
, serves as a "stand-in" for code to be inserted later.
Python3 Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically-typed and garbage-collected. It supports multiple programming par ...
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, an ellipsis is used to represent a variable number of parameters to a
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-oriente ...
. For example: : The above function in C could then be called with different types and numbers of parameters such as: : and :
C99 C99 (previously known as C9X) is an informal name for ISO/IEC 9899:1999, a past version of the C programming language standard. It extends the previous version ( C90) with new features for the language and the standard library, and helps impl ...
introduced macros with a variable number of arguments.
C++11 C++11 is a version of the ISO/ IEC 14882 standard for the C++ programming language. C++11 replaced the prior version of the C++ standard, called C++03, and was later replaced by C++14. The name follows the tradition of naming language versions b ...
included the C99 preprocessor, and also introduced templates with a variable number of arguments.


Java

As of version 1.5,
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mos ...
has adopted this "varargs" functionality. For example: :


PHP

PHP 5.6 supports use of ellipsis to define an explicitly
variadic function In mathematics and in computer programming, a variadic function is a function of indefinite arity, i.e., one which accepts a variable number of arguments. Support for variadic functions differs widely among programming languages. The term ''vari ...
, 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 Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
, 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 MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementa ...
, a three-character ellipsis is used to indicate line continuation, 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 In Raku an actual
Unicode Unicode, formally The Unicode Standard,The formal version reference is is an information technology standard for the consistent encoding, representation, and handling of text expressed in most of the world's writing systems. The standard, wh ...
(U+2026) ellipsis (…) character is used to serve as a type of marker in a format string.


References

{{reflist Operators (programming)