1. another error i can't figure

In the following code:

if equal(sign,'+') then
    if    equal('o',newmodes[1]) then on_op(nicks[1])
    elsif equal('v',newmodes[1]) then on_voice(nicks[1])
    elsif equal('b',newmodes[1]) then on_ban(nicks[1])
    end if
  end if

Why do i get this error?:

Syntax error - expected to see possibly 'end', not a function
    if    equal('o',newmodes[1]) then on_op(nicks[1])
                                          ^

Kat

new topic     » topic index » view message » categorize

2. Re: another error i can't figure

Hi Kat,

send me the full code and I'll look into it. It's all too=
 familiar with me. Your either nesting loops incorrectly, or=
 forgetting to match braces girl.

antoine

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

3. Re: another error i can't figure

Kat wrote:

> Syntax error - expected to see possibly 'end', not a function
>     if    equal('o',newmodes[1]) then on_op(nicks[1])
>                                           ^

If on_op() is a function (and not a procedure), you need to assign the
return value to something. Euphoria isn't like some other languages and
can't discard return values if there's no preceding assignment operator.

It took me a while before I realised that this is probably what's going on.
I was going to suggest putting an 'end' there to see what happened... :)

HTH,
Carl

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

4. Re: another error i can't figure

Hi Kat,

Could it be you accidentally hit single or double quote between=
 end  and   if, in my editor they don't show up, they're dead=
 keys influencing your next entry with an accent. I use an=
 personalised version of Context.

Antoine

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

5. Re: another error i can't figure

>The standard work
>arounds on offer are:
>
>   object VOID (or junk)
>   if    equal('o',newmodes[1]) then VOID = on_op(nicks[1]) ...
>
>or
>
>   procedure o_op_proc(object x)
>   end procedure
>   if    equal('o',newmodes[1]) then on_op_proc(nicks[1]) ...
>
>both are not pretty.

Or, another way:

procedure ignore (object x)
    x = x -- just to avoid warning about unused parameter
end procedure

So, you just do

if equal ('o', newmodes[1]) then ignore (on_op (nicks[1]))

You can, than, put procedure 'ignore' in, say, miscx.e:

---- miscx.e ----
include misc.e

global procedure ingore ...
...
end procedure 
---- end of miscx.e ----

And, instead of misc.e, you always use miscx.w

Regards...
Alexa

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

Search



Quick Links

User menu

Not signed in.

Misc Menu