Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
define argument types in subs
#31
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:
I'd knock on wood, but my desk is particle board.
Reply
#32
Bleh thats a cover up for writing sloppy code :roll:
Reply
#33
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
I'd knock on wood, but my desk is particle board.
Reply
#34
Well i too comment on something difficult. But I leave the comments as they are if its a long term project =).
Reply
#35
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
Reply
#36
Dude, make a point. Just dont post code. Its....err.....wierd =P
Reply
#37
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.
Reply
#38
Hehe, your code looks scary with all those 'eeks' in it... *eek* Wink
Reply
#39
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?
Reply
#40
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)
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)