Cancel
Showing results for 
Search instead for 
Did you mean: 

'for to' command

Pioneer
Pioneer

I have a variable named NrPallets with a value of 10,000.

Im creating a method to create objects and have received an error on line 4, corresponding to the 'to' statement.

Im struggling to see the error, could someone explain the 'to' part of the function and why this error has occured? many thanks.

 

var I: integer
var t: object

for I := to NrPallets
    t := .MUs.Pallet.create(root.AssemblyStation.PalletStore)
    t.PalletNr := 1
next

2 REPLIES

Re: 'for to' command

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

the initializing of the iterator is missing:

 

var i: integer
var t: object

for i:=1 to NrPallets
    t := .MUs.Pallet.create(root.AssemblyStation.PalletStore)
    t.PalletNr := 1
next

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: 'for to' command

Pioneer
Pioneer
fixed. thank you!