Advertisement
Guest User

Untitled

a guest
May 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "aulib.bi"
  2.  
  3. type Robot
  4.     as uinteger ID
  5.     as integer x,y
  6. end type
  7.  
  8. 'Creates the new class from the template
  9. DeclareList(Robot)
  10. 'The new class name is going to be "Robot" with "List" appended to it
  11. dim as RobotList robots
  12.  
  13. dim as Robot a,b,c
  14. a.ID = 0
  15. a.x = 5
  16. a.y = 9
  17.  
  18. b.ID = 1
  19. b.x = 24
  20. b.y = 99
  21.  
  22. c.ID = 2
  23. c.x = 41
  24. c.y = 63
  25.  
  26. robots.add(a)
  27. robots.add(b)
  28. robots.add(c)
  29.  
  30. print("Length 1")
  31. print robots.length()
  32.  
  33. dim as Robot fromList = robots.item[1]
  34.  
  35. print("FromList")
  36. print fromList.x, fromList.y
  37.  
  38. robots.remove(1)
  39.  
  40. print("Length 2")
  41. print robots.length()
  42.  
  43. print("Start ForEach")
  44. 'ForEach(Robot rbt in robots)
  45. foreach(rbt, robots)
  46.     print rbt.ID, rbt.x, rbt.y
  47. next
  48.  
  49. sleep()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement