rock crashes with an empty main function that returns 0

124 views
Skip to first unread message

h3l1xc ​

unread,
Jan 15, 2016, 3:12:14 PM1/15/16
to ooc-lang
Hello! I'm getting my hands dirty with ooc, and my first attempt to make a program was an empty main function that returns 0 (very simple, to get the taste of ooc's syntax):

main: func (args: String[]) -> Int {
      return 0
}


And it failed. Worse, rock crashed. I got this output. But, when I add something to the function, like in here:

main: func (args: String[]) -> Int {
      "Test!" println()
      return 0
}


It compiles flawlessly and works. What am I missing?

cheesy.fr...@gmail.com

unread,
Mar 12, 2016, 5:56:29 PM3/12/16
to ooc-lang
Also getting this error, same output.

janlim...@gmail.com

unread,
Apr 23, 2017, 1:02:50 AM4/23/17
to ooc-lang, cheesy.fr...@gmail.com
i am also new to ooc, so i cannot tell u what's going wrong... but ever since ooc functions seems to follow a functional aproach much like lisp, scheme, haskell and others, you do not need the return keyword. It seems the last statement (expression) is the result. So, code it like this

main: func (args: String[]) -> Int {
0
}

a function that simply returns 0.
Reply all
Reply to author
Forward
0 new messages