小编use*_*126的帖子

此表达式具有类型单元,但期望表达式为int类型

我在OCaml的程序中有一个错误,我正在寻求帮助.

错误:

This expression has type unit but an expression was expected of type int
Run Code Online (Sandbox Code Playgroud)

包含错误的行错误 soma = soma

let soma = 0;;
let rec nBell n = 
if n == 0 then 1 
    else
        for k=0 to n-1 do 
        soma = soma + ((fact(n-1)/(fact(k)*fact((n-1)-k))) * nBell(k));
            done;;`
Run Code Online (Sandbox Code Playgroud)

谁能帮我?

ocaml

3
推荐指数
1
解决办法
8364
查看次数

标签 统计

ocaml ×1