Menu

[b84aab]: / samples / distro-examples / tests / array.bas  Maximize  Restore  History

Download this file

32 lines (25 with data), 537 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/sbasic
? cat(1);"TEST:";cat(0);" Arrays, unound, lbound"
dim m(1 to 3, -1 to 1)
m(1, -1) = 1
m(2, 0) = 2
m(3, 1) = 3
if m(1,-1)<>1 then ? "ERR 1"
if m(2,0)<>2 then ? "ERR 2"
if m(3,1)<>3 then ? "ERR 3"
for i=1 to 3
for j=-1 to 1
m(i,j)=(i*10)+j
next
next
for i=1 to 3
for j=-1 to 1
if m(i,j)<>(i*10)+j then
? "ERROR (";i;",";j;")"
fi
next
next
if lbound(m)<>1 then ?"LBOUND() ERROR"
if ubound(m)<>3 then ?"UBOUND() ERROR"
if lbound(m,2)<>-1 then ?"LBOUND() ERROR"
if ubound(m,2)<>1 then ?"UBOUND() ERROR"
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.