Take the 2-minute tour ×

In my AS-level computing course we're using Turbo Pascal, and for extension work I've been given the task of making a Blackjack/21 style card game. I decided to make a unit for general card game data structures:

unit CardLib;


    CardSuite = (clubs, diamonds, hearts, spades);

    Card = record

    CardDeck = object
        cards: Array[0..51] of Card;
        freeIndex: Integer;
        constructor init;
        procedure addNewCard(suite:CardSuite, name:String, value:Integer);
        procedure addCard(c:Card);
        function drawCard:Card;
        destructor done;

    CardHand = object
        cards: Array[0..51] of Card;
        freeIndex: Integer;
        constructor init(deck:CardDeck, size:Integer);
        function getLowestTotal:Integer; {Aces are worth 1}
        function getHighestTotal:Integer; {Aces are worth 11}
        procedure addCard(c:Card);
        destructor done;

I'm compiling this code with Free Pascal in Turbo Pascal compatibility mode, but I'm getting the following error:

CardLib.pas(18,39) Fatal: Syntax error, ")" expected but "," found
Fatal: Compilation aborted
Error: /usr/bin/ppcarm returned an error exitcode (normal if you did not specify a source file to be compiled)

If I comment out the addNewCard procedure, I get the same error in the CardHand constructor instead. Any ideas what's causing this?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Use semicolons to separate the parameters.

procedure addNewCard(suite:CardSuite; name:String; value:Integer);
share|improve this answer
That would make sense, I think the var keyword would cause the parameters to be passed as references, which could be desired behaviour for me, but if I use the var keyword I still get the same error. –  geckojsc Nov 14 '12 at 18:12
I know semicolons are used to end statements but can they be used as a separator here? That's all I got when it comes to guessing. –  C H Vach Nov 14 '12 at 18:19
Yes, that fixed it! Slightly confusing because parameters of the same time can still be grouped with commas (a,b,c:Integer) and also parameters are passed with commas. I'm used to ActionScript 3 syntax so I assumed that commas would be used for normal procedure declarations too. Cheers, feel free to make an answer for this. –  geckojsc Nov 14 '12 at 18:29

Your Answer


