Author Topic: Equivalent of PB Array Scan command  (Read 1641 times)

0 Members and 1 Guest are viewing this topic.

chrisc

  • Guest
Equivalent of PB Array Scan command
« on: March 24, 2018, 11:42:25 AM »
in PB we have an Array Scan command, according to
http://manmrk.net/tutorials/basic/PowerBASIC/pbcc/array_scan_statement.htm

Code: [Select]
Scan all or part of an array for a given value.

Syntax


Numeric array:

ARRAY SCAN array([index]) [FOR count], expression, TO lvar&

String arrays:

ARRAY SCAN array ([index]) [FOR count] [, FROM start TO end] [, COLLATE {UCASE |

    cstring}], expression, TO lvar&


what is the O2 equivalent to this command?

Charles Pegge

  • Guest
Re: Equivalent of PB Array Scan command
« Reply #1 on: March 24, 2018, 01:42:20 PM »

Hi Chris,

That command is one of the most complicated command I have ever encountered. It just needs to be broken down into regular Basic, then it becomes comprehensible.

Code: [Select]
'2018-03-24 T 21:29:07
'ARRAY SCAN FUNCTIONALITY
int a={2,4,6,8,1,3,5,7,9} 'some data for testing
int i,j
j=0
for i=1 to countof a
  if a[i]<2 then j=i : exit for
next
print j '5'