FunctionsFTW/FizzBuzz

From Esolang
Jump to navigation Jump to search
setNum("i", 1);                             "Initialize i";
label("l");
if(not(gt(getNum("i"), 100)), () {          "If i isn't greater than 100";
  if(eqNum(rem(getNum("i"), 15), 0), () {     "If i is divisable by 15";
    print("FizzBuzz");                          "Print FizzBuzz";
  }, () {
  if(eqNum(rem(getNum("i"), 3), 0), () {      "Else if i is divisable by 3";
    print("Fizz");                              "Print Fizz";
  }, () {
  if(eqNum(rem(getNum("i"), 5), 0), () {      "Else if i is divisable by 5";
    print("Buzz");                              "Print Buzz";
  }, () {                                     "If all checks above failed";
    print(numToStr(getNum("i")));               "Print i";
  }); }); });
  print("\n");                                "Return";
  setNum("i", add(getNum("i"), 1));           "Increment i by 1";
  goto("l");                                  "Repeat";
}, () {});

Minimized (319 bytes)

setNum("i",1);label("l");if(not(gt(getNum("i"),100)),(){if(eqNum(rem(getNum("i"),15),0),(){print("FizzBuzz");},(){if(eqNum(rem(getNum("i"),3),0),(){print("Fizz");},(){if(eqNum(rem(getNum("i"),5),0),(){print("Buzz");},(){print(numToStr(getNum("i")));});});});print("\n");setNum("i",add(getNum("i"),1));goto("l");},(){});