Neko - variant returns


(Brian Tiffin) #1

Still exploring Neko, figured a Rosetta Code task might help with the practice.

99 bottles of beer.

Now the question. Is this valid Neko (it works, but I’m wondering if variant return types are sane to use)? n is numeric.

var nonesome = function(n) {
  return if (n > 0) n else "No";

The objective is return the number or “No” on zero. Should the n return be wrapped in a string cast?

Again, tests ok, but I’m wondering if that is in the spirit of Neko. If yes, follow up question:

What is the neko -doc syntax for documenting function : int -> int (or string)

If no, I guess someone should fix the Rosetta entry. before I spread too many falsehoods about Neko.

Have good, make well