如何在 f# 中编写此代码
int IAI.AIMove()
{
for (int i = 0; i <= 8; i++)
if (cBoard.getPlayer(i) == 0)
return i;
return 0;
}
这就是我所拥有的
member this.AIMove()=
let result = int in
for i in 1 .. 8 do
if cboard.getPlayer(i)=0 then
result := Some i
[错误] 此表达式应为 int 类型,但此处为 unit 类型