functions decleration

瀏覽次數:135 次
跳到第一則未讀訊息

David Ben-Michael

未讀,
2019年5月30日 上午10:43:202019/5/30
收件者:Nemerle Forum
. have some problem in decleration of functions at nemerle
.I want to write recursive calling of function, but i did not succeed to handle with the function declartion
.At nemerle it is not passable to call a function that her defination is beneath the calling steatment
?Does There is a way to declare the functions at the beginning of the program and implement them at diffrent places
 

catbert

未讀,
2019年5月31日 清晨5:04:052019/5/31
收件者:Nemerle Forum
Hi David!

Writing recursive functions is pretty easy in Nemerle:

def factorial(x) { if (x == 0) 1 else x * factorial(x - 1) }

You don't need forward declarations for this, and Nemerle does not support them.

Regards,
  -- Ivan.

четвер, 30 травня 2019 р. 16:43:20 UTC+2 користувач David Ben-Michael написав:
回覆所有人
回覆作者
轉寄
0 則新訊息