1. ROBERT CRAIG

-- Attention Robert:
-- I am using Euphoria ver 2.0
-- I am having a problem with compiling a if/elsif/else
-- Please explain to me what I am doing wrong

integer a, b, c, d

a = 1
b = 2
c = 3
d = 4
----------------- this will compile OK
if a = 1 then
    ? d
end if
if a = 2 then
    ? d
end if
if a = 3 then
    ? d
end if
----------------- If you try to compile this
----------------- compiler will report an error
----------------- but this should be ok
-- if a = 1 then
--    ? d
-- elsif a = 2 then
--    ? d
-- else a = 3 then  --     <<----- this fails
--    ? d
-- end if
----------------- by changing the else to elsif
----------------- compiler will not report an error
----------------- but I am not sure this compiles to the same thing
if a = 1 then
    ? d
elsif a = 2 then
    ? d
elsif a = 3 then  --     <<----- changed else to elsif
    ? d
end if
---------------

Thank You for your time

Bernie

new topic     » topic index » view message » categorize

2. Re: ROBERT CRAIG

Bernie,

There is no such thing as  'else ... then' clause. Your line is interpreted as a
simple assignment  'a = 3' followed by 'then' WITHOUT matching 'if' or 'elsif'.
jiri

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

3. Re: ROBERT CRAIG

DAAAAAA !!!!
     My brain is geting too old, my eyes are too weak and my tongue keeps

     getting caught in my eye tooth and I can't see what I am saying.

Thanks Bernie

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

Search



Quick Links

User menu

Not signed in.

Misc Menu