dotnet / dotnet/vblang

[Proposal] Array Ranges

Open
#559 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

I suggest to allow:
`Dim A = {1 To 5}`
which means:
`Dim A = {1, 2, 3, 4, 5}`
we can use such ranges in copying arrays too:
`Dim B = A[2 To 4]`
B will have `{3, 4, 5}` since index 2 refers to the third element in the array. In fact 0-based indexing will be a bit confusing here, and we can argue if we should use 1-based indexing in this particular syntax or not!
This cab also be used with strings:
```
Dim x = "This is a test"
Console.WriteLine(x[10 to 13]) ' Test
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.