(Recursive) nested loops and IFs?
|
12-18-2015, 08:06 AM
(This post was last modified: 12-18-2015 09:35 AM by Didier Lachieze.)
Post: #7
|
|||
|
|||
RE: (Recursive) nested loops and IFs?
(12-17-2015 08:20 PM)chromos Wrote: In this case you have to use ΠLIST: ΠLIST(list) returns the product of the list elements which is the equivalent of a Boolean AND while ∑LIST(list) returns the sum of the list elements which is the equivalent of a Boolean OR. Nested IF conditions can be replaced by ANDs: PHP Code: IF (EXPR(L5(1))>=0 AND EXPR(L5(1))<=9) THEN is the same as: PHP Code: IF (EXPR(L5(1))>=0 AND EXPR(L5(1))<=9) AND (EXPR(L5(2))>=0 AND EXPR(L5(2))<=9) AND (EXPR(L5(3))>=0 AND EXPR(L5(3))<=9) THEN EXECON("EXPR(&1)>=0 AND EXPR(&1)<=9",L5) returns a list with the result of the test for each element of L5, either 0 (false) or 1 (true). Then ΠLIST returns the product (AND) of all these results: 0 (false) if at least one is false and 1 (true) if all are true. As we work with lists this is not tied to the number of variables. (12-17-2015 08:20 PM)chromos Wrote: 2) Nested loops: I didn't try your code yet, but I will. There is ΠLIST again so I should study its usability much more. Here L4-L3 returns a list of the differences between the elements of L4 and L3, so ΠLIST(L4-L3) returns the product of these differences which gives the total number of loops to do. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(Recursive) nested loops and IFs? - chromos - 12-17-2015, 07:17 AM
RE: (Recursive) nested loops and IFs? - chromos - 12-17-2015, 07:28 AM
RE: (Recursive) nested loops and IFs? - Didier Lachieze - 12-17-2015, 11:50 AM
RE: (Recursive) nested loops and IFs? - chromos - 12-17-2015, 12:15 PM
RE: (Recursive) nested loops and IFs? - Didier Lachieze - 12-17-2015, 04:17 PM
RE: (Recursive) nested loops and IFs? - chromos - 12-17-2015, 08:20 PM
RE: (Recursive) nested loops and IFs? - Didier Lachieze - 12-18-2015 08:06 AM
RE: (Recursive) nested loops and IFs? - chromos - 12-18-2015, 10:25 PM
RE: (Recursive) nested loops and IFs? - Didier Lachieze - 12-18-2015, 10:40 PM
RE: (Recursive) nested loops and IFs? - chromos - 12-18-2015, 11:32 PM
RE: (Recursive) nested loops and IFs? - Didier Lachieze - 12-19-2015, 12:00 AM
RE: (Recursive) nested loops and IFs? - chromos - 12-19-2015, 12:05 AM
RE: (Recursive) nested loops and IFs? - chromos - 01-17-2017, 11:46 AM
|
User(s) browsing this thread: 4 Guest(s)