Post Reply 
IFTE function cmd and store cmd
11-12-2018, 05:57 PM (This post was last modified: 11-12-2018 06:58 PM by compsystems.)
Post: #1
IFTE function cmd and store cmd
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

PHP Code:
#cas
test_IFTE( ):=
begin
  local x
yz;
  
:= 1
  
:= []; 
  
:= [ falsefalsetruetrue ];
  
index := 1;
  
REPEAT 
    ifte
z[x] == true,  concatytrue )▶ynop ); 
    
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:
iftez[x] == true,  := concatytrue ), nop ); 
// also fails

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?

LO SUFICIENTEMENTE BUENO ES ENEMIGO DE LA EXCELENCIA.
Find all posts by this user
Quote this message in a reply
11-12-2018, 09:17 PM
Post: #2
RE: IFTE function cmd and store cmd
try;
EXECON("IF &1==true THEN L0:=concat(L0,true); L0:=L0[0]; ELSE nop; END;",[false,false,true,true,true,false,true])
Find all posts by this user
Quote this message in a reply
11-12-2018, 09:25 PM
Post: #3
RE: IFTE function cmd and store cmd
Or simply :
z:=[false,false,true,true,true,false,true]
remove(false,z)
Find all posts by this user
Quote this message in a reply
11-13-2018, 06:06 AM
Post: #4
RE: IFTE function cmd and store cmd
Hello,

Be carefull, EXECON is a home command, not a cas command.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 3 Guest(s)