[Scilab-users] Getting the variable name used for a function input argument
Samuel Gougeon
sgougeon at free.fr
Mon Dec 6 18:33:04 CET 2021
Hello Jens,
Le 06/12/2021 à 10:40, Jens Simon Strom a écrit :
> Hi Samuel,
> Your solution is quite sophisticated.
On the opposite, it aims to be simpler.
> To me it was confusing to call a function without the input being
> bracketed. And on top of this, that a variable of type /constant/ is
> accepted as a /string/ within the function.
As a cherry on the cake, the syntax will work as well for literal values:
function printc(name)
execstr("c = "+name)
//Drucken einer komplexen Zahl mit Betrag und Winkel/°
Format = strsubst(name,"%","%%")+': %f /_%7.2f°\n'
mprintf(Format, abs(c), 180/%pi*atan(imag(c), real(c)))
endfunction
--> printc 3-4*%i
3-4*%i: 5.000000 /_ -53.13°
> Scilab seems to be more flexible than I would dare to imagine before now.
Handiness is one of the signatures of high level languages.
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20211206/715a401a/attachment.htm>
More information about the users
mailing list