Re: if statement with sequences

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

> > sequence s
> > s = {"o", 3}
> >
> > i want to check if there's an o, so i had this
> >
> > if s[1] = "o" then do whatever
> >
> > it doesn't work, i tried changing it to
> >
> > if s[1] = 'o' then do whatever
> > if s[1] = 111 then do whatever

    sequence s

-- your case:

    s = {"o", 3}

    if compare(s[1],"o") then   -- note: "0" is a sequence,
        ? s[1]                  -- so is s[1]. look at compare().
    else
        ? "not eaual!"
    end if

--  but note the following case:

    s = {'o', 3}                -- 'o' an integer which
                                -- represents char. 'o'
    if s[1] = 'o'  then
        ? s[1]
    else
        ? "not eaual!"
    end if

Have a nice day, Rolf

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

Search



Quick Links

User menu

Not signed in.

Misc Menu