hebi 0.4.0

A dynamic scripting language
Documentation
---
source: src/internal/vm/tests.rs
expression: snapshot
---
# Source:
class Counter:
  n = 0
  max = 0

  init(self, max):
    self.max = max

  fn iter(self):
    return self

  fn next(self):
    if self.n < self.max:
      n := self.n
      self.n += 1
      return n

  fn done(self):
    return self.n >= self.max

collect(Counter(10))


# Result:
Object(
    [
        Int(
            0,
        ),
        Int(
            1,
        ),
        Int(
            2,
        ),
        Int(
            3,
        ),
        Int(
            4,
        ),
        Int(
            5,
        ),
        Int(
            6,
        ),
        Int(
            7,
        ),
        Int(
            8,
        ),
        Int(
            9,
        ),
    ],
)