dytra
dytra

Reputation: 305

How to make function with multiple parameters with different data type in pascal?

I have made a function with 2 parameters with the same data type and I have no problem with that.

But I'm having trouble with different data type

Here's my code :

uses crt;
function inputscore(name : string, score:integer) : integer;

begin
     writeln('My name is ',name,' and my score is ',score);
     inputscore:=0;
end;

begin
    clrscr;

    inputscore('David',98);
    readkey;
end.

But It returned this error message:

multipleparameterfunc.pas(2,34)Fatal syntax error, ")" expected but "," found

Upvotes: 3

Views: 4539

Answers (1)

Wosi
Wosi

Reputation: 45153

In Pascal you separate the arguments with a ;. So your definition has to look like this:

function inputscore(name: string; score: integer) : integer;

When you call the function then you still use a , to separate the parameters:

inputscore('David', 98);

Upvotes: 10

Related Questions