1. Pair of Problems partly solved

I changed it to "get" and it works fine but now it gives me the message
"true/false condition must be an ATOM.  at the line below.

...
object j
object b
object c
object A
object B
if i = 0 or y = 0 then -- this line!!
    puts (SCREEN, "Can't divide by zero!!\n")
    else
    puts (SCREEN, "Dividing first number by second.\n")
        z = y / i
? z
    puts (SCREEN, "Dividing second number by first.\n")
        b = i / y
? b
    puts (SCREEN, "Addition\n")
        x = y + i
? x
    puts (SCREEN, "Multiplication\n")
        w = y * i
? w
    puts (SCREEN, "Subtract second number from first.\n")
        j = y - i
? j
    puts (SCREEN, "Subtract first number from second.\n")
        c = i - y
? c
    puts (SCREEN, "Square root of first number.\n")
        A = sqrt (i)
? A
    puts (SCREEN, "Square root of second number.\n")
        B = sqrt (y)
? B
end if

new topic     » topic index » view message » categorize

2. Re: Pair of Problems partly solved

then try atom(i). That should work.

_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

new topic     » goto parent     » topic index » view message » categorize

3. Re: Pair of Problems partly solved

>I changed it to "get" and it works fine but now it gives me the message
>"true/false condition must be an ATOM.  at the line below.


I cant tell by the code you gave, however I suspect you want to know this:

Get returns a sequence of 2 element.
The first element is the succes/error value, the second the result value.

in = get (0)

-- Now type: "Hello, dear!"
if in[1] = GET_FAIL then
    puts (1, "Whatever you typed, it didnt make sence for me!\n")
elsif in[1] = GET_EOF then
    puts (1, "You typed too little, why not finish it before pressing
enter!\n")
elsif in[1] = GET_SUCCES then
    puts (1, "Now, that *does* make sense!\n")
    print (1, in[2])
end if

-- in[2] only contains the value whenever in[1] = GET_SUCCES which is
whenever we could make a number out of the input.

Remember that Euphoric input using print () and get () is pretty flexible.
If the user enters: { 1, 2, 3} it will return {1, 2, 3}
So be aware, the user is also allowed to define whole sequences, or use
heximal values..

There is a very nice demo program that comes with euphoria that shows
exactly how to use get () and print ().

Ralf

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu