encyclopegia.org

Range (computer programming)

In computer science, the term range may refer to one of three things: # The possible values that may be stored in a variable. # The upper and lower bounds of an array. # An alternative to iterator.

In computer science, the term range may refer to one of three things: The possible values that may be stored in a variable. The upper and lower bounds of an array. An alternative to iterator. public record Range (T Start, T End) where T : IComparable; Example in Kotlin. data class Range >(val start: T, val end: T) Example in PHP. readonly class Range { public function __construct( public T $start, public T $end, ) {} } Example in Python. from dataclasses import dataclass @dataclass class Range[T]: start: T end: T Rust has a built-in range struct in the standard library in . C++ has a library as well since C++20. let heartwarming = "heartwarming!".to_string(); let warm = &heartwarming[5..9]; Zig also has the operator. // To iterate over consecutive integers, use the range syntax. var sum: usize = 0; for (0..5) |i| { sum += i; } As does C#, string[] items = ["one","two","three","four"]; string[] firstThreeItems = items[0..2]; F#, [1..4] // Outputs: [1; 2; 3; 4] Kotlin, for (i in 1..5) print(i) and Perl. for( 1..5) { print } Python and PHP does not have any range operator but they do have a function.

References

No reference rows published for this article.

Cite this article

MLA

"Range (computer programming)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/range-computer-programming. Accessed 24 November 2026.

Chicago

"Range (computer programming)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/range-computer-programming.

APA

encyclopegia.org. (2026). Range (computer programming). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/range-computer-programming

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

STklos

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1377539724 · 0.5 · snapshot enwiki-001377539724

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.