帕斯卡语法错误 [英] Pascal Syntax Error

查看:62
本文介绍了帕斯卡语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序中有以下功能:

I have the following function in my program:

function Getrand(rStart,rEnd:Integer): Integer;
var
diff: Integer;

begin
diff := rEnd - rStart;

Getrand := Random(diff) + rStart;
end;

当我尝试编译程序时,出现此错误:

When I try to compile the program, I get this error:

Failed when compiling
Line 27: [Error] (27:9): Invalid number of parameters in script 

我做错了什么?

推荐答案

也许您的 Pascal 风格不支持传统的返回值语法.尝试 Result := ... 而不是 Getrand := ....

Perhaps your flavour of Pascal doesn't support the traditional return value syntax. Try Result := … instead of Getrand := ….

这篇关于帕斯卡语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆