Hi guys,
can somebody please give me a hint what could be wrong in this short code ?
if the field "username" is item 3 of group "dguser" in stack "usergroup"
then
if the field "password" is item 3 of group "dguser" in stack "usergroup"
then
close this stack
go to stack "entry"
end if
end if
LiveCode always says error button "login": compilation error at line 3 (if: missing 'then') near "in", char 48
I don't get it.. there is a "then". I tried to write the whole code once more or to restart LiveCode or restart my computer.
Nothing.. always the same error message. I really hope that someone can help me with this.
best regards
Nibor
Question about " if "
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Question about " if "
Hi... in your example you need to use 'AND" as you want to evaluate more than one condition ...
I haven't tested this, just off the top of my head... but it should point you in the right direction..
Dixie
Code: Select all
on mouseUp
if fld "username" = "Boo" AND fld "password" = "Hoo" then
lock screen
open stack "entry"
close stack "whateverTheNameIs"
end if
end mouseUp
Dixie
Re: Question about " if "
Hi Nibor,
as Dixie said AND:
This line does not make any sense, since "item X of group Y" does not resolve to any TEXT:
...
if the field "password" is item 3 of group "dguser" in stack "usergroup"
...
Only FIELDS (and custom properties, but that will come much later
) can resolve to TEXT.
Hint: To be on the safe side, use the official syntax:
1. if field "xyz"...
## not THE field
2. ... OF stack "Y"
## not IN stack, same for cards -> OF card
Best
Klaus
as Dixie said AND:
This line does not make any sense, since "item X of group Y" does not resolve to any TEXT:
...
if the field "password" is item 3 of group "dguser" in stack "usergroup"
...
Only FIELDS (and custom properties, but that will come much later

Hint: To be on the safe side, use the official syntax:
1. if field "xyz"...
## not THE field
2. ... OF stack "Y"
## not IN stack, same for cards -> OF card
Best
Klaus
Re: Question about " if "
Thanks to both of you =)
Re: Question about " if "
Dixie.
You can do the double test in two lines, though I agree it is clunkier. But that would not throw an error.
Craig
You can do the double test in two lines, though I agree it is clunkier. But that would not throw an error.
Craig