Qbasicnews.com
define argument types in subs - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html)
+--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html)
+--- Thread: define argument types in subs (/thread-3186.html)

Pages: 1 2 3 4 5 6


define argument types in subs - adosorken - 02-16-2004

That reminds me of an old coder's phrase...

"Real coders don't comment. If it was hard to code, it should be hard to understand."

:lol: :lol: :lol:


define argument types in subs - TheBigBasicQ - 02-16-2004

Bleh thats a cover up for writing sloppy code :roll:


define argument types in subs - adosorken - 02-16-2004

I don't comment my code, and I don't think I code sloppy (anymore)... Big Grin I only use comments where I'm approaching a difficult task and need it broken down into steps. I delete the comments afterwards. Tongue


define argument types in subs - TheBigBasicQ - 02-18-2004

Well i too comment on something difficult. But I leave the comments as they are if its a long term project =).


define argument types in subs - Dr_Davenstein - 02-24-2004

Sub Hmmm(eek as MyDataType)

Code:
DECLARE SUB Hmmm (eek AS ANY)



TYPE MyDataType
X AS INTEGER
Y AS INTEGER
N AS STRING * 13
END TYPE


DIM eek AS MyDataType

eek.X = 1
eek.Y = 15
eek.N = "Dr_Davenstein"



Hmmm eek

SUB Hmmm (eek AS MyDataType)
PRINT eek.X
PRINT eek.Y
PRINT eek.N
END SUB



define argument types in subs - TheBigBasicQ - 02-24-2004

Dude, make a point. Just dont post code. Its....err.....wierd =P


Re: define argument types in subs - Dr_Davenstein - 02-25-2004

Quote:Is there a way to define the types of arg in a sub? For exemple, set them all to integer? DEFINT doesn't work here.

define a(integer1, integer2)


That was the original post...

Quote:Dude, make a point. Just dont post code. Its....err.....wierd =P
:roll:

Dude, it isn't weard. I just assumed that he would run the code that I posted. It was just another example of how to define the types of arguements in a sub.


define argument types in subs - Neo - 02-25-2004

Hehe, your code looks scary with all those 'eeks' in it... *eek* Wink


define argument types in subs - KiZ - 02-25-2004

ok, heres a question which is a variation of that.

if you have an array, with a datatype, why cant you pass it into a sub?

ie why cant you:
Code:
CALL subblah(var1, var2, array(x).Z)
where subblah is a sub which calls for 3 inputs.

why cant you do this?


define argument types in subs - na_th_an - 02-25-2004

Quote:ok, heres a question which is a variation of that.

if you have an array, with a datatype, why cant you pass it into a sub?

ie why cant you:
Code:
CALL subblah(var1, var2, array(x).Z)
where subblah is a sub which calls for 3 inputs.

why cant you do this?

as far as I know, you can.

Code:
DECLARE SUB subblah(var1%, var2%, var3%)

TYPE bleh
   Z AS INTEGER
END TYPE

DIM array(10) AS bleh

CALL subblay (1, 2, array(5).Z)