Newcomer with a problem

new topic     » topic index » view thread      » older message » newer message

Hello, everyone.  I'm new to Euphoria, and have been having a problem
that I can't seem to find the answer to in the documentation.  It's
probably there, I'm just horrible at finding things like that.

I'm wondering about function and procedure declaration.  Currently,
I've got a function and a procedure.  They both call the other at one
point in their block, but because one appears before the other, the
interpreter says the second one is undefined (and therefore will not
continue running the program).

I know that C++ has function prototypes.  Does Euphoria have anything
similar that allows for function/procedure/type declarations?

Here's a sample of the code for the function and procedure, although
I don't feel it will be relevant (and yes, I do realize it's probably
not done in the most efficient manner.  I'm new, after all!):

procedure check_menu_input(integer x)
 if x < 1 or x > 2 then
  menu()
-- The line above is the problem causing line.  The interpreter says
-- menu() has not yet been declared.
 elsif x = 1 then
  story1()
 elsif x = 2 then
  story2()
 end if
end procedure

function menu()
 -- Story menu
 printf(1, "\n\nPlease choose one:",0)
 printf(1, "\n1. A visit to the _",0)
 printf(1, "\n2. Dear Teacher",0)
 menu_num = waitkey(0)
 check_menu_input(menu_num)
end function

Thanks in advance,

Matt Williams

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu