Re: Live Tutoria?

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

>
>That's exactly what the program I sent you above does?
>Run it and press ESC.
>
> > But it=20
> > crashes.  "Variable Key has not been assigned a value."  What is the=

>causin=
> > g=20
> > the error, please?  And how do I assign Key a value?
> >
> > Love & Friendship & Blessed Be!
> > Lynn Erika Kilroy
> >
> > Learning.ex
> > ========================
==
> > ========================
==
> > =============
> > include ..\..\include\Inkey.e
> >
> > integer Key
> >
> > Prekey()
> >
> >
> > while Key != 27 do
> >
> > Key = Inkey()
> >
> > ? Inkey()
> >
> > end while
> > ========================
==
> > ========================
==
> > =============
> >
> > Inkey.e
> > ========================
==
> > ========================
==
> > =============
> > global function Inkey()
> > return get_key()
> > end function
> >
> > global procedure Prekey()
> > while Inkey() > -1 do
> > end while
> > end procedure
>
>I'll work on your error and get back to you.
>

If I use your code, then I've learned nothing about how Euphoria works.  If=

you send me code that I can play with that's simple and allows me to draw=

conclusions about how the statements and variables all work together, then =
I
will learn how the language works.

My efforts are to learn to write the code by putting together assorted
smaller subroutines {procedures} and then making larger and more complicate=
d
ones.  If a program fails to operate, then we can discuss what it is that=

I'm trying to do and how I am trying to go about it so I can see what it is=

that I'm doing wrong, so as not to repeat the mistake in the future.

I tend to use a standard set of functions and subs {procedures}.  It would=

be best to recreate clones of these and use them in Euphoria for two
reasons.  The first is that these subs and functions will more closely
resemble what I'm used to using, and the second is that through the process=

of creating these subs and functions, I would learn more about Euphoria and=

have a better understanding how to use the language.

The first function, Inkey(), is written.  But I do not know truly if it
works yet.  It is intended to read a key from the keyboard buffer and retur=
n
the result to the calling program, and is also intended to be kept in an=

include file so I can add it without having to retype it over and over and=

over again.  The second part, a procedure, is Prekey.  It calls Inkey until=

Inkey returns nothing {and seems to work}.  This is done to clear the
keyboard buffer, as it has been my experience this is often necessary.

The main program is setup as follows: Include Inkey.e file, with Inkey and=

Prekey.  Define Key as an integer.  The definition goes well.  While Key !=
=
27 do, also executes.  Key = Inkey(), then ? Key.  At ? Key, it says
Variable Key is unassigned.  The theory is it will print Key on each pass.=
=20=20
This is just a test routine, so I don't care if it messes up the display.  =
I
want to know that this, my first Euphoria program, works right.  It isn't.=
=20=20
So I will include the program and it's include file again.


The Program Learning.Ex:
==================
>include ..\..\include\Inkey.e
>
>integer Key
>
>Prekey()
>
>
>while Key != 27 do
>
>Key = Inkey()
>
>? Inkey()
>
>end while
==================
End Program File Learning.Ex

The Include File Inkey.e
===============
>global function Inkey()
>return get_key()
>end function
>
>global procedure Prekey()
>while Inkey() > -1 do
>end while
>end procedure
===============
End Include File Inkey.e

The error is:
========
>D:\LEKSSOFT\EUPHORIA\SOURCE\LEARNING\LEARNING.EX:8
>variable Key has not been assigned a value
>--> see ex.err
========
End Error

Begin Ex.Err
========
>D:\LEKSSOFT\EUPHORIA\SOURCE\LEARNING\LEARNING.EX:8
>variable Key has not been assigned a value
>
>
>Global & Local Variables
>
>D:\LEKSSOFT\EUPHORIA\SOURCE\LEARNING\LEARNING.EX:
>    Key = <no value>
========
End Ex.Err

Please help me understand what is causing this error and how I can fix this=

part of my program.  It is a pretty basic program, but one has to start
somewhere. {Smiles}

Thank you very much!

Love & Friendship & Blessed Be!
Lynn Erika Kilroy

-New Users Make Basic Errors.  But to ***REALLY*** screw things up, that=

takes an experienced user!

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

Search



Quick Links

User menu

Not signed in.

Misc Menu