sannybuilder/dev

Support Ranges

Opened this issue · 0 comments

x87 commented

Syntax

Inspired by Rust range syntax: https://doc.rust-lang.org/reference/expressions/range-expr.html

lower bound..upper bound
lower bound..=upper bound
lower bound..
lower bound..=
..upper bound
..=upper bound

.. upper bound is not included in the range
..= upper bound is included in the range

Usage

  • support in switch
switch 0@

 case 0, 1.., ..=100, 1000..2000
    //
 case 100..=200
   //
end
  • support in FOR
for 0@ in 0..100
end

for 0@ in 0..=200
end