Re: Rehashing Switch
Posted: Sun Mar 21, 2021 8:37 pm
Hi @Craig, now after rereading this whole thread I understand what you mean. Or so i think
jjj
From what I can understand is that if you have 3 cases and none have a break. The LiveCode Script evaluates the first one that is true and will continue until it finds a break or the end of the switch statements, ignoring the other conditions that are in the other cases. But if doing what they are within these cases.
I think it's called a lazy algorithm or something like that that some guru can explain better.
It is also used in if statements
If Condition 1 And Condition 2 then
If condition 1 is not met, it will not evaluate condition 2, this is an advantage when coding and also makes our programs run faster.
I think that is the reason why it does not continue to evaluate the other conditions.
From what I can understand is that if you have 3 cases and none have a break. The LiveCode Script evaluates the first one that is true and will continue until it finds a break or the end of the switch statements, ignoring the other conditions that are in the other cases. But if doing what they are within these cases.
I think it's called a lazy algorithm or something like that that some guru can explain better.
It is also used in if statements
If Condition 1 And Condition 2 then
If condition 1 is not met, it will not evaluate condition 2, this is an advantage when coding and also makes our programs run faster.
I think that is the reason why it does not continue to evaluate the other conditions.