UBOUND
ub = UBOUND (array [, dim])
Returns the upper bound ub
of an array
array
. dim
can be used to specifiy, at which
dimension the upper bound should be returned if array
is a
multi-dimensional array. If dim
is not used the upper bound
of the first dimension will be returned.
See LBOUND for lower bound of an array.
Example 1: Upper bound of one-dimensional arrays
dim A(5)
dim B(5 to 10)
print ubound(A) ' Output: 5
print ubound(B) ' Output: 10
Example 2: Upper bound of multi-dimensional arrays
dim A(5,6,7)
dim B(5 to 10, 7 to 12, 9 to 14)
print ubound(A, 2) ' Output: 6
print ubound(B, 2) ' Output: 12
Example 3: Using option base 1
option base 1
dim A(5)
dim B(5 to 10)
print ubound(A) ' Output: 5
print ubound(B) ' Output: 10
Code samples using UBOUND
006 arrays+.bas
3d rotating cube with message.bas
3d_torus.bas
3dtorus.bas
bezier's autograph book.bas
bezierbounce.bas
calendar.bas
checkers.bas
checkers.bas
chess.bas
chess.bas
coordplot.bas
gui_cal.bas
hangman v2.bas
hangman.bas
image_demo.bas
insert delete test.bas
lib-dmscon.bas
mine sweeper v4sb.bas
palm_cli.bas
palmcli.bas
pen pad.bas
snake.bas
Weekday.bas
weekday.bas
zacalc.bas
Data
APPEND
ARRAY
DATA
DELETE
DIM
EMPTY
ERASE
INSERT
ISARRAY
ISDIR
ISFILE
ISLINK
ISMAP
ISNUMBER
ISSTRING
LBOUND
LEN
READ
REDIM
RESTORE
SEARCH
SORT
SWAP
UBOUND
If there is insufficient information on this page and you wish learn more about UBOUND,
please send an email to smallbasic@gmail.com. You can help to improve information about
UBOUND by submitting a pull request,
click View Source for details. Note, an offline language reference text file is also available - see the Download section.