Filter: Difference between revisions

No edit summary
Line 2,990:
<syntaxhighlight lang="q">x where 0=x mod 2</syntaxhighlight>
 
==={{header|QBASIC}}===
{{works with|QuickBasic|4.x}}
{{works with|Visual Basic for DOS|1.0}}
Line 2,999:
' Filter
' This program selects certain elements from an array into a new array in a generic way
' Extra points: Destroys the original values in the array
 
' SUBs
Line 3,008 ⟶ 3,009:
CONST Uneven = 1
DIM t AS INTEGER
Dim t2 AS INTEGER
DIM i AS INTEGER
DIM iArray%(1 TO 1)
DIM iArray2%(1 TO 1)
 
' Register
Line 3,034 ⟶ 3,035:
 
' Shows the result
tt2 = UBOUND(iArray2iArray%)
IF tt2 > 0 THEN
PRINT "Selected items from the array (total:"; tt2; "of"; UBOUND(iArray%)t; "):"
FOR i = 1 TO tt2
PRINT iArray2iArray%(i);
NEXT i
END IF
Line 3,055 ⟶ 3,056:
DIM rSub AS regSub
SHARED iArray%()
SHARED iArray2%()
CONST aName$ = "DUMMY$$$.$$$"
CONST False = 0, True = NOT False
Line 3,082:
' Redims the 2nd array
t = LOF(f) / LEN(rSub)
REDIM iArray2iArray%(1 TO t)
 
FOR i = 1 TO t
GET #f, i, rSub
iArray2iArray%(i) = rSub.aNum
NEXT i
58

edits