Re: RTFM, was: Liberty Basic

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

At 03:25 AM 4/26/98 -0600, David Mosley wrote:

>Hi
>OK I will bite.What do you mean packed into the same seq?
>Is there a more simpleer way?.

Not really simpler, just different: instead of keeping two
lists (q's, and a's) you just make a single sequence in
this form:
QandA = {{question1,answer1},{question2,answer2}}
then you refer to them this way:
printf(1,"%s",{QandA[1][1]}) -- asks question #1
printf(1,"%s",{QandA[1][2]}) -- shows the answer for #1

Is that better or worse? For me, it is a little more work and
a bit less clear, but that's a personal preference. If you were
going to change the questions or answers, and then save them
back to disk, you'd probably want to use this form. The whole
thing could be written with a single "print(fn,QanA)" -- but,
it would not be easy to edit with a text editor anymore.
You win some, you lose some.

And thanks for all the help it works now and I
>know why.I went back and checked my other programs and I was real close but
>left out a few { } in the right place.Also am I useing with trace right
like these
>with trace
>trace(1)

Yes.
Trace is great, but also a little confusing, because of the
way it has to display stuff. Since a sequence or object
may contain anything, trace just has to show the contents
in a "generic" way, which often _looks_ way different from
what you put into the sequence. Sometimes it's better
to stick little printf() lines in to be sure you can get out
what you are putting in.

>because when I run the q file example(question[answer]) program it does not
>give me what the varables are in the program and what they contain at the
>given line of code like when it reads from a file I can not see it do the
>get and append thing.

You won't be able to see much of a sequence with trace,
anyway (it runs out of screen space). One thing has me
puzzled : Euphoria trace lets us check a variable that's
not shown on the screen by typing "? var"  (if var = 23,
then we'll see "var=23" pop up at the bottom of the screen.
Why can't we type "? seq[2]" to see the contents of the
second bit of seq?

Irv

Spam Haiku:-------------------
Silent, former pig
One communal awareness
Myriad pink bricks
-------------------------------------

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

Search



Quick Links

User menu

Not signed in.

Misc Menu