PDA

View Full Version : Usage of ITERATE



Petr Schreiber
28-05-2007, 20:30
Hi,

my attempt to create sample for ITERATE,
the data filling part could be replaced with "'-- some data loaded here --" or something like that"



dim index as long

type tAgenda
age as byte ' Years
payment as long ' Money
drivingLicense as byte ' 0 = no, 1 = yes
end type

%ITEMS = 3
dim Person(%ITEMS) as tAgenda

Person(1).age = 24
Person(1).payment = 1000
Person(1).drivingLicense = 1

Person(2).age = 32
Person(2).payment = 1000
Person(2).drivingLicense = 0

Person(3).age = 64
Person(3).payment = 1000
Person(3).drivingLicense = 1

' -- Raise payment for people older and equall to 32, and in case they
' -- have driving license too then some money extra
for index = 1 to %ITEMS

if Person(index).age < 32 then iterate for ' -- Too young, quickly jump to NEXT person index
Person(index).payment = Person(index).payment + 1000

if Person(index).drivingLicense = 0 then iterate for ' -- No driving license, quickly jump to NEXT person index
Person(index).payment = Person(index).payment + 500

next



Bye,
Petr

ErosOlmi
29-05-2007, 03:31
Got it. Thanks