11-12-2018, 05:57 PM
Hello,
I want to extract the "TRUE" values from an array
[ false, false, true, true ] => [ true, true ]
In the following code there is a problem when trying to store a variable within IFTE function cmd
if I delete y: = or ▶y it works but the value of y is not updated
[Check] No errors in the program
test_IFTE() [Enter] returns
// also fails
test_IFTE() [Enter] returns
REQUEST: An alternative or simpler code with functions cmd and not block of structures?
I want to extract the "TRUE" values from an array
[ false, false, true, true ] => [ true, true ]
In the following code there is a problem when trying to store a variable within IFTE function cmd
if I delete y: = or ▶y it works but the value of y is not updated
PHP Code:
#cas
test_IFTE( ):=
begin
local x, y, z;
x := 1;
y := [];
z := [ false, false, true, true ];
index := 1;
REPEAT
ifte( z[x] == true, concat( y, true )▶y, nop );
x++;
until
x == 5;
return y;
end;
#end
[Check] No errors in the program
test_IFTE() [Enter] returns
Quote:1,[0,0,true,true,true] ???
[ true, true ] // ok
PHP Code:
ifte( z[x] == true, y := concat( y, true ), nop );
test_IFTE() [Enter] returns
Quote:"for([0,1,0,{
ifte(((z[x])==true),y:=concat(y,true),'nop');
x++;
IF x = 5 THEN BREAK ; END ;
}]) in [test_IFTE] instruction #7 error, try debug([test_IFTE])
Error: Bad Argument Value"
REQUEST: An alternative or simpler code with functions cmd and not block of structures?