Posts: 2,771
Threads: 96
Joined: Oct 2003
hmm... *goes and makes a test program*
Nope, it defitely doesnt work.
It highlights the period and says "Parameter type mismatch"
this is the test I used:
Code:
DECLARE SUB blah (i!, a!)
TYPE bler
z AS INTEGER
END TYPE
DIM array(10) AS bler
blah i, array(x).z
SUB blah (i, a)
print "hello"
END SUB
Posts: 6,419
Threads: 74
Joined: Mar 2002
Quote:hmm... *goes and makes a test program*
Nope, it defitely doesnt work.
It highlights the period and says "Parameter type mismatch"
this is the test I used:
Code:
DECLARE SUB blah (i!, a!)
TYPE bler
z AS INTEGER
END TYPE
DIM array(10) AS bler
blah i, array(x).z
SUB blah (i, a)
print "hello"
END SUB
Of course it does not work. You are declaring your parameters as SINGLE and you are attempting to pass INTEGER parameters.
Change the code to:
Code:
DECLARE SUB blah (i%, a%)
TYPE bler
z AS INTEGER
END TYPE
DIM array(10) AS bler
blah i%, array(x%).z
SUB blah (i%, a%)
print "hello"
END SUB
Posts: 2,771
Threads: 96
Joined: Oct 2003
...
duh!! I cant believe I didnt see that! Even the error was telling me what was wrong! yeesh. I am too tired to realise these things... sorry nath.
Posts: 4,307
Threads: 63
Joined: May 2003
Dark you can pass a whole array as well:
Code:
TYPE mytype
ab as integer
cd as string * 10
END TYPE
SUB mysub(foo() as mytype, n%)
for i% = 1 to n%
print foo(i%).ab
print foo(i%).cd
next
END SUB
DIM myarr(1 to 20) as mytype
FOR m% = 1 to 20
myarr(m%).ab = m% + 5
myarr(m%).cd = CHR$(m% + 5)
NEXT
mysub(myarr(), 20)
Havent tested it but it should work =).
Posts: 2,771
Threads: 96
Joined: Oct 2003
Cool, i see how. ok, thanks.
Posts: 4,307
Threads: 63
Joined: May 2003
Did my example work? I've to still test it =P.
Posts: 3,288
Threads: 167
Joined: Nov 2001
Quote:I don't comment my code, and I don't think I code sloppy (anymore)... I only use comments where I'm approaching a difficult task and need it broken down into steps. I delete the comments afterwards.
Why do you do that? If I may ask?
:???:
Posts: 4,307
Threads: 63
Joined: May 2003
Isnt it obvious? He doesnt want anyone to understand what he has written =P.
Posts: 3,288
Threads: 167
Joined: Nov 2001
Well , he can just didtribute w/o the source. :*)
Posts: 4,307
Threads: 63
Joined: May 2003
no, he will distribut the source.