Question

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;

interface

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

    Card = record
        name:String;
        value:Integer;
        suite:CardSuite;
    end;

    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;
    end;

    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;
    end;
...

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?

Was it helpful?

Solution

Use semicolons to separate the parameters.

procedure addNewCard(suite:CardSuite; name:String; value:Integer);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top