Content deleted Content added
Salix alba (talk | contribs) →Range as a operator: add C# range operator |
Salix alba (talk | contribs) →Range as a operator: F# Kotlin |
||
Line 78:
</syntaxhighlight>
As does [[C Sharp (programming language)|C#]],<ref>{{cite web|last1=BillWagner|access-date=2025-02-22|title=Explore ranges of data using indices and ranges - C#|url=https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/ranges-indexes|date=14 November 2023|website=learn.microsoft.com}}</ref>
<syntaxhighlight lang="C#">
string items[] = ["one","two","three","four"];
string first_three_items[] = items[0..2];
</syntaxhighlight>
[[F Sharp (programming_language)|F#]],<ref>{{cite web|access-date=2025-02-22|title=Range Operator|url=https://camilotk.github.io/fsharp-by-example/chapters/range-operator/|date=17 February 2023|website=F# by example}}</ref>
<syntaxhighlight lang="F#">
[1..4]
// Outputs: [1; 2; 3; 4]
</syntaxhighlight>
and [[Kotlin (programming language)|Kotlin]].<ref>{{cite web|access-date=2025-02-22|title=Ranges and progressions - Kotlin|url=https://kotlinlang.org/docs/ranges.html#progression|website=Kotlin Help}}</ref>
<syntaxhighlight lang="Kotlin">
for (i in 1..5) print(i)
</syntaxhighlight>
|