Re: Coming From QBasic

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

Lynn Kilroy wrote:
> 
> Does the Global function thingy have to be included in the main body of the=
> code, even if the function is in an included file?  And how about the
> subroutines?  How do I call them?
> 
> Love & Friendship & Blessed Be!
> Lynn Erika Kilroy
(snip)

As you've probably seen Euphoria doesn't have BASIC/COBOL style subroutines.
However, you can kind of replicate this with procedures using global variables.

integer key

procedure inkey()
    key = get_key()
end procedure

inkey()


When you declare something as global in an include file that means that when you
include it everything declared as global becomes available in the main file. For
example:

-- Inside some include file
constant BLAH = "stuff"

global integer foo

global function bar()
    ...
end function

procedure baz()
    ...
end procedure


When this file is included foo and bar can be used in the code whereas baz and
blah can not.


The Euphoria Standard Library project :
    http://esl.sourceforge.net/
The Euphoria Standard Library mailing list :
    https://lists.sourceforge.net/lists/listinfo/esl-discussion

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

Search



Quick Links

User menu

Not signed in.

Misc Menu