/tutorial/agent/example1.e
Specman e | 31 lines | 23 code | 5 blank | 3 comment | 0 complexity | 612c332124bbe4e3578e78d20c4e02d0 MD5 | raw file
1class EXAMPLE1 2 -- 3 -- To start with agents, just read this first example. 4 -- 5 6create {ANY} 7 make 8 9feature {ANY} 10 make 11 local 12 my_array: ARRAY[STRING] 13 do 14 my_array := {ARRAY[STRING] 1, << "Benedicte", "Lucien", "Marie" >> } 15 my_array.for_each(agent print_item(?)) 16 end 17 18feature {} 19 print_item (item: STRING) 20 do 21 number := number + 1 22 std_output.put_character('#') 23 std_output.put_integer(number) 24 std_output.put_character(' ') 25 std_output.put_string(item) 26 std_output.put_character('%N') 27 end 28 29 number: INTEGER 30 31end -- class EXAMPLE1