home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / sviluppo / purebasic_demo / purebasic / examples / demoversion_sources / linkedlist.pb next >
Encoding:
Text File  |  2000-01-27  |  898 b   |  60 lines

  1. ;
  2. ; ***************************************
  3. ;
  4. ; Linked List example file for Pure Basic
  5. ;
  6. ;     © 1999 - Fantaisie Software -
  7. ;
  8. ; ***************************************
  9. ;
  10. ;
  11.  
  12. Structure MyList
  13.   Pad.w
  14.   Name.s
  15. EndStructure
  16.  
  17. NewList TestList.MyList()
  18.  
  19. AddElement(TestList())
  20. TestList()\Name = "Hello"
  21.  
  22. AddElement(TestList())
  23. TestList()\Name = "World"
  24.  
  25. AddElement(TestList())
  26. TestList()\Name = "CooooL"
  27.  
  28. ;FirstElement(TestList())
  29. ;KillElement (TestList())
  30. ;
  31. ;ResetList   (TestList())
  32. ;FirstElement(TestList())
  33. ;LastElement (TestList())
  34. ;
  35. ;AddElement(TestList())
  36. ;TestList()\Name = "I'm Here"
  37.  
  38. ResetList(TestList())
  39.  
  40. While NextElement(TestList())
  41.   PrintN(TestList()\Name)
  42. Wend
  43.  
  44. LastElement(TestList())
  45.  
  46. While PreviousElement(TestList())
  47.   PrintN(TestList()\Name)
  48. Wend
  49.  
  50. NewList Trial.s()
  51.  
  52. PrintNumberN(CountList(TestList()))
  53.  
  54. FirstElement(TestList())
  55. PrintNumberN(ListIndex(Trial()))
  56.  
  57. MouseWait()
  58.  
  59. End
  60.