Re: step_two() has not been declared ???
- Posted by Irv Mullins <irv at ELLIJAY.COM> Jan 15, 2000
- 457 views
On Sat, 15 Jan 2000, timmy wrote: > Hi i'm writting a program but I'm getting a strange > err when I try to run the first stage. Euphoria keeps > telling me that a procedure has'nt been declared, but, > everything looks right??? I wrote the program below. You could probably do what you want by using routine_id. However, before you try it, consider this: I don't know about Euphoria, but in most programming languages, code such as the following will create a new instance of the routine on the stack each time routine one callls routine two, and another each time routine two calls routine one, eventually filling all available memory with procedure calls which leads to a nasty crash. In other words, its better to do this in some other way. As someone suggested, a while 1 do ... end while loop would work. Regards, Irv ------------ > include keyread.e > > object a, b, c > atom x > x = 0 > > > > -- Step one (waiting for change) > procedure step_one() > while x = 0 do > a = get_keys() > for t = 1 to 50000 do > c = 1 > end for > b = get_keys() > x = compare(a, b) > end while > x = 0 > step_two() > end procedure > -- Step one Done > > > > procedure step_two() > > print(1, "A =") > print(1, a) > print(1, "B =") > print(1, b) > step_one() > end procedure > > step_one() > > ---- end of program---