block: function end_function/EndFunc

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 561
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

block: function end_function/EndFunc

Message par compsystems » lun. févr. 04, 2019 2:06 am

Hello BP, the syntax flexibility of xcas makes you like it a lot, some users like it, the start and end of blocks with symbols { ... }, others in a more explicit way, that is to say with words, for example in pseudocodigo the block function ... end_function is used

Please add the reserved word end_function or endFunc synonym of the reserved words ffonction or EndFunc (TI68k mode)


Thank you.

Code : Tout sélectionner

f1(x) := 
{ // begin
  local k; // or var k;
  k:=5;
  return x*k; // or only x*y;
}; // end

f2(x) :=
begin  
  local k;
  k:=5;
  return x*k;
end;

function f3(x)
begin  
  local k;
  k:=5;
  return x*k;
end;

function f4(x)
  local k;
  k:=5;
  return x*k;
ffonction; // end_function

f5 := function(x) 
  local k;
  k:=5;
  return x*k;
ffonction; 

function f6(x)
begin  
  local k;
  k:=5;
  return x*k;
ffonction;

//TI68k mode
:f7(x)
:Func
:  Local k
:  5->k
:  Return x*k
:EndFunc


//result of compilation
//(x)-> 
//{ local k; 
// k:=5;  
// return(x*k);  
//}
Of course, the best syntax is python, so avoid placing block endings.

Répondre