New extension: Functions

The next extension for the Interpreter challenge is now live: Functions.

This extension builds on the work from the previous one and covers Chapter 10 of the book.

By the end of this extension, your interpreter will be able to support defining and calling functions, as well as managing function scopes and return values. Here’s a sneak peek at what you’ll achieve:

var count = 3;

fun tick() {
  if (count > 0) {
    print count;
    count = count - 1;
    return false;
  }
  print "Blast off!";
  return true;
}

while (!tick()) {}

Please give this a try and let us know how it can be improved! @ryan-gang (author of this extension), and I will be available here to help out with any tester or instruction-related issues.

3 Likes