/tutorial/agent/example1.e

http://github.com/tybor/Liberty · Specman e · 31 lines · 23 code · 5 blank · 3 comment · 0 complexity · 612c332124bbe4e3578e78d20c4e02d0 MD5 · raw file

  1. class EXAMPLE1
  2. --
  3. -- To start with agents, just read this first example.
  4. --
  5. create {ANY}
  6. make
  7. feature {ANY}
  8. make
  9. local
  10. my_array: ARRAY[STRING]
  11. do
  12. my_array := {ARRAY[STRING] 1, << "Benedicte", "Lucien", "Marie" >> }
  13. my_array.for_each(agent print_item(?))
  14. end
  15. feature {}
  16. print_item (item: STRING)
  17. do
  18. number := number + 1
  19. std_output.put_character('#')
  20. std_output.put_integer(number)
  21. std_output.put_character(' ')
  22. std_output.put_string(item)
  23. std_output.put_character('%N')
  24. end
  25. number: INTEGER
  26. end -- class EXAMPLE1