| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Passing an array. |
How does one pass an array to a SUB as in the following?
I tried a couple of different things, and I get different errors,
but nothing that works... Maybe you have the answer. [grin]
===============
DEF FUNCTION DoAray(STRING) AS WORD
DIM Aray1(100) AS STRING 'different arrays, each passed to the same
DIM Aray2(50) AS STRING 'function.
[... code that works on the arays...]
PRINT DoAray (Aray1)
PRINT DoAray (Aray2)
STOP
FUNCTION DoAray (tAray() AS STRING) -{don't know what goes here
FOR x=1 TO UBOUNDS(tAray) 'depends on the aray passed
IF LEN(tAray(x)) THEN INCR SCnt
NEXT
FUNCTION = SCnt
END FUNCTION
--- Maximus/2 3.01
---------------
** A related thread FOLLOWS this message.
FIDO MESSAGE AREA==> TOPIC: 214 POWER BASIC Ref: E21H1493 Date: 02/01/97
From: KURT KUZBA Time: 01:24pm
\/To: TIM HUTZLER (Read 3 times)
Subj: R: Passing an array.
TH> How does one pass an array to a SUB as in the following?
th>......
did you try it like this?
DECLARE FUNCTION DoAray(A() AS STRING) AS WORD
DIM Aray1(100) AS STRING
DIM Aray2(50) AS STRING
FOR T% = 0 to 80
Aray1(T%) = "testing"
Aray2(T% \ 2) = "testing"
NEXT
PRINT DoAray(Aray1())
PRINT DoAray(Aray2())
SYSTEM
FUNCTION DoAray(A() AS STRING) AS WORD
FOR x%= LBOUND(A) TO UBOUND(A)
IF LEN(A(x%)) THEN INCR SCnt%
NEXT
DoAray = SCnt%
END FUNCTION
---
> ] * Origin: Madman BBS * Chico, California * 916-893-8079 * (1:119/88)* Origin: Madman BBS * Chico, California * 916-893-8079 * (1:119/88) |
|
| SOURCE: echomail via exec-pc | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.