Skip to main content
gamedev.net
🔒 Locked

pascal help???

Started by rholding2001 Feb 20, 2005 at 8:23 AM 5 replies 500+ views
Original Post
rholding2001
rholding2001
ive read the books and practically copied it... why doesnt this work if (Anarray[j].entryone == userentry1) and (Anarray[j].entrytwo == userentry2) the error is an illegal expression hmm whats this all aboot?
visit my site http://www.fullf1.com for all your formula 1 and music creation needs.
gcs584
gcs584
Quote:
Original post by rholding2001
if (Anarray[j].entryone == userentry1) and (Anarray[j].entrytwo == userentry2)


Hmm...I only know Delphi which is very similar to Pascal, not?

It should be:

    if (Anarray[j].entryone = userentry1) and (Anarray[j].entrytwo = userentry2) then    begin    end;


Notice the '=' instead of the '=='. I hope that I'm of some help!

GCS584
rholding2001
rholding2001
thanks thats great

how would i return an answer ... the func returns true or false (boolean) and i want to return "yes the answer is" if true else "No" if not, see im a c++ programmer but im trying to learn pascal as a support language
visit my site http://www.fullf1.com for all your formula 1 and music creation needs.
gcs584
gcs584

Hi,

I'm a C++ programmer myself. Here, I'll give you an example (if nobody beats me to it).

I'm not exactly sure what you mean, but I'll give you an example of a function:

function test( x : Integer ) : boolean;begin        if x = 2 then        test := true        else test := false;end;


So...if you see your return var would be the function name or you can do 'result := false/true'.

Notice how the return type is at the top of the line (boolean).

I hope that works...

GCS584
rholding2001
rholding2001
oh im quite a reasonable noob programmer i just cant get my head around the syntax of pascal over c++, for a training language its all very very hard to do anything... c++ seems to be way easier to learn than this if you take out pointers and advance class uses
visit my site http://www.fullf1.com for all your formula 1 and music creation needs.
gcs584
gcs584


Was that of any help though? I'm going out and will be back much later. If you need further help don't hesitate to PM me.

I'm not much of a fan of Pascal myself; some people love it though. It's just not what I'm used to/started off with.

Later,

GCS584
rholding2001
rholding2001
yeah man thanks a lot, you are indeed very helpful and have advanced me forwards, im just having mass problems out putting an answer to my function/procedure

really all i want is this

1. program asks for say an music artist
2. it searches through an array of artists until it finds the name
3. when it does find the artist it prints out a location of it in a shop for eg

im not sure what im doing wrong cos i did the thing in c++ and it works

i just cant seem to output anything without errors.... frustrating... ahhhhhhhhHHHHHHHHHHH
visit my site http://www.fullf1.com for all your formula 1 and music creation needs.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.