Results 1 to 2 of 2

Thread: Usage of ITERATE

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Usage of ITERATE

    Hi,

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

    [code=thinbasic]
    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
    [/code]


    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Usage of ITERATE

    Got it. Thanks
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •