Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do you determine the length of an array?
#11
Quote:Having the subroutine be able to determine the array's properties makes the subroutine more self-contained and possibly more adaptive to being used generically.

True, for something like a general sort or whatever...
Reply
#12
pass the reference not the number.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#13
And what does *that* have to do with anything?
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply
#14
What happens if your array is dimmed dynamically or randomly? (Don't ask me when this would happen)
Reply
#15
What happens if your array is dimmed dynamically or randomly? What about momoguru? Why do you need to know the number of indexes? (Give me help!)
Reply
#16
For the number of indices (yes, that's the REAL plural word for it) you can just make it more dynamic. Say you have a screen buffer, but you make the lib so it can be different lengths. Then you have a buffer filling routine that loops through the array and puts the color numbers. You use UBOUND to get to the end of the array without recoding each buffer size.

Oh and, it is possible to get PUT color values. From Nexus13:

' Determine color value
' ---------------------
IF colour < 128 THEN
c = colour * 257 'Calc fill value if attribute < 128
ELSE
c = colour * 257 - 65536 'Calc fill value if attribute > 127
END IF

' Fill page using color
' ---------------------
max = UBOUND(array, 1) 'Determine maximum words to set
FOR i = 6 TO max 'Set all words starting at element 6
array(i) = c 'Store calculated fill value
NEXT
am an asshole. Get used to it.
Reply
#17
You wouldn't understand...
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#18
As far as I know, LBOUND and UBOUND still work with them.

Quote:What happens if your array is dimmed dynamically or randomly? What about momoguru? Why do you need to know the number of indexes? (Give me help!)
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply
#19
you can still keep track with random/dynamic arrays.

I'd only use those things if it would otherwise be real complicated to track down teh length.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#20
Glad to see it could possibly be some use to someone. I'll call it "Oracle's Function"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)