Multiple Conditionals on if statement?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9660
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Multiple Conditionals on if statement?
This harkens all the way back to HC, which vacillated between considering it a feature that an unquoted literal, would, eventually, as Klaus mentioned, be resolved into a, er, literal, or, a mild no-no.
It is a terrible idea. I like to see my literals as literals, so I do not confuse them with variables. Quotes do that trick so nicely. Even I can manage that level of discipline.
Craig
It is a terrible idea. I like to see my literals as literals, so I do not confuse them with variables. Quotes do that trick so nicely. Even I can manage that level of discipline.
Craig
Last edited by dunbarx on Thu Feb 13, 2020 9:11 pm, edited 1 time in total.
Re: Multiple Conditionals on if statement?
Hee hee, that sounds like you are being so darned literal
(I owe you a steak for that one, I think I hit a new low in the cornpone that should go nicely with steak)
(I owe you a steak for that one, I think I hit a new low in the cornpone that should go nicely with steak)
Re: Multiple Conditionals on if statement?
I agree, everyone should always quote literals properly. It's not just sloppy code otherwise, it is prone to failure (as it should be).
-
- VIP Livecode Opensource Backer
- Posts: 9660
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Multiple Conditionals on if statement?
What Sparkout said.
Way, way back, because I thought it more compact for some reason, I used both quoted literals and also the same string for control names. These were usually related. There was a small benefit for me, keeping similar stuff in much the same place in a handler.
Don't.
Craig
Way, way back, because I thought it more compact for some reason, I used both quoted literals and also the same string for control names. These were usually related. There was a small benefit for me, keeping similar stuff in much the same place in a handler.
Don't.
Craig
Re: Multiple Conditionals on if statement?
Just so there is no question about it, I am of the same mind despite any bad jokes I might spin about it.
There is still something funny going on in poor JackieBlue1970's case which is not what they think it is.
There is still something funny going on in poor JackieBlue1970's case which is not what they think it is.
-
- VIP Livecode Opensource Backer
- Posts: 9660
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Multiple Conditionals on if statement?
JackieBlue1970 says that:
This is OK:
but this, nope:
This last is simpler to grok than the snippet at the top, which is structurally similar. "Fld 1", in quotes, can not and does not reference a field.
That dog don't hunt.
Craig
implying that works as he wanted. It cannot work at all.instead of if "Fld1" is empty...
This is OK:
Code: Select all
if "" is empty then answer "What did you expect?"
Code: Select all
if "empty" is empty then answer ""Well, what did you expect?"
That dog don't hunt.
Craig
-
- Posts: 64
- Joined: Thu Jan 16, 2020 10:28 pm
- Location: Max Meadows, VA USA
Re: Multiple Conditionals on if statement?
I tested both ways multiple times. I’ll try to get the code next week. This is just a side project for my business and I only work on it occasionally in the afternoon.bogs wrote: ↑Wed Feb 12, 2020 9:33 pmI don't think that is the issue, JackieBlue1970JackieBlue1970 wrote: ↑Wed Feb 12, 2020 9:21 pmIf field "Fld1" is empty and field "Fld2" is empty then
instead of if "Fld1" is empty...
Field is indeed a keyword, it identifies the object you are testing, in this case field "fld1" and field "fld2". I modified the stack I posted above to include the wording because that is exactly how you should be referring to controls/objects, and it works here after I named my fields "fld1" and "fld2".
If it wouldn't be asking too much, could you possibly post the code you had before the changes you made? I, and I'm sure many others, would love to take a look at what was going on that was causing the original problem.
aPic_field1-2.png
Re: Multiple Conditionals on if statement?
Sounds good, I'm sure that the problem could be found in short orderJackieBlue1970 wrote: ↑Sat Feb 15, 2020 4:50 pmI’ll try to get the code next week. This is just a side project for my business and I only work on it occasionally in the afternoon.
-
- Posts: 64
- Joined: Thu Jan 16, 2020 10:28 pm
- Location: Max Meadows, VA USA