Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "aulib.bi"
- type Robot
- as uinteger ID
- as integer x,y
- end type
- 'Creates the new class from the template
- DeclareList(Robot)
- 'The new class name is going to be "Robot" with "List" appended to it
- dim as RobotList robots
- dim as Robot a,b,c
- a.ID = 0
- a.x = 5
- a.y = 9
- b.ID = 1
- b.x = 24
- b.y = 99
- c.ID = 2
- c.x = 41
- c.y = 63
- robots.add(a)
- robots.add(b)
- robots.add(c)
- print("Length 1")
- print robots.length()
- dim as Robot fromList = robots.item[1]
- print("FromList")
- print fromList.x, fromList.y
- robots.remove(1)
- print("Length 2")
- print robots.length()
- print("Start ForEach")
- 'ForEach(Robot rbt in robots)
- foreach(rbt, robots)
- print rbt.ID, rbt.x, rbt.y
- next
- sleep()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement