johneastman / boomerang

An interpreted programming language written in Python
https://jeastman.pythonanywhere.com/
MIT License
0 stars 0 forks source link

Built-in Function: range #54

Closed johneastman closed 1 year ago

johneastman commented 1 year ago

Return a list of numbers based on the parameters given.

  1. With one param: generate number from 0 to n (inclusive of both)
  2. With two params: generate number from n to m (inclusive of both)
  3. If the range goes from high to low, generate numbers in descending order
  4. If the range goes from low to high, generate numbers in ascending order
  5. Support negative numbers

Instead of 3 and 4, include an optional third parameter, step, that increments the next value in the sequence by that value. Include floating-point values, and if start is greater than end but step is not negative, raise an exception.

johneastman commented 1 year ago

Commit: https://github.com/johneastman/boomerang/commit/c065f4bd04474bf8da5f32451263aa62b415d02b