mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Ranges (ie: for (int a in 0..<count)
for (int i in 1…10)
)
This commit is contained in:
parent
e561a26695
commit
465050b81d
11 changed files with 418 additions and 18 deletions
43
IDE/mintest/minlib/src/System/Range.bf
Normal file
43
IDE/mintest/minlib/src/System/Range.bf
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System
|
||||
{
|
||||
struct Range
|
||||
{
|
||||
protected int mStart;
|
||||
protected int mEnd;
|
||||
|
||||
public this()
|
||||
{
|
||||
mStart = 0;
|
||||
mEnd = 0;
|
||||
}
|
||||
|
||||
public this(int start, int end)
|
||||
{
|
||||
Debug.Assert(end >= start);
|
||||
mStart = start;
|
||||
mEnd = end;
|
||||
}
|
||||
}
|
||||
|
||||
struct ClosedRange
|
||||
{
|
||||
protected int mStart;
|
||||
protected int mEnd;
|
||||
|
||||
public this()
|
||||
{
|
||||
mStart = 0;
|
||||
mEnd = 0;
|
||||
}
|
||||
|
||||
public this(int start, int end)
|
||||
{
|
||||
Debug.Assert(end >= start);
|
||||
mStart = start;
|
||||
mEnd = end;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue