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
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
...
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.
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 =).
Cool, i see how. ok, thanks.
Did my example work? I've to still test it =P.
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?
:???:
Isnt it obvious? He doesnt want anyone to understand what he has written =P.
Well , he can just didtribute w/o the source. :*)
no, he will distribut the source.