LowerBound()
UpperBound()
- LowerBound()
LowerBound()功能得到指定数组第n维的下界。
语法LowerBound ( array {, n } )
参数array:数组名n:数值类型,可选项,指定要得到数组哪一维的下界。缺省值为1返回值Long。函数执行成功时返回array数组第n维的下界。如果n的值超过了指定数组的最大维数,那么该函数返回-1。如果任何参数的值为NULL,LowerBound()函数返回NULL。 - UpperBound()
UpperBound()功能得到指定数组第n维的上界。
语法UpperBound( array {, n } )
参数array:数组名n:数值类型,可选项,指定要得到数组哪一维的上界。缺省值为1 返回值Long。函数执行成功时返回array数组第n维的上界。如果n的值超过了指定数组的最大维数,那么该函数返回-1。如果任何参数的值为NULL,UpperBound()函数返回NULL。
上界是指数组的维数
实例:
integer a[5]
UpperBound(a) // Returns 5
UpperBound(a,1) // Returns 5
UpperBound(a,2) // Returns -1; no 2nd dimension
integer b[10,20]
UpperBound(b,1) // Returns 10
UpperBound(b,2) // Returns 20
integer c[ ]
UpperBound(c) // Returns 0; no memory allocated
c[50] = 900
UpperBound(c) // Returns 50
c[60] = 800
UpperBound(c) // Returns 60
c[60] = 800
c[50] = 700
UpperBound(c) // Returns 60
integer d[10 to 50]
UpperBound(d) // Returns 50
可以关注下微信公众号:将PB进行到底,里面有这方面的更详细的讲解!
本文介绍如何使用LowerBound()和UpperBound()函数获取数组的维度上下界。通过实例展示了不同数组配置时函数的返回值。
888

被折叠的 条评论
为什么被折叠?



