User:MichaelFrey/echo

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Example[edit | edit source]

echo(echo());

echo(echo("Test"));

echo(echo("Test") "Hallo");

Example[edit | edit source]

function D(x) = echo(x) x;

function blah(a, b) = a + D(b);

c = blah(3, 6);

Example 0[edit | edit source]

function g(x) = x*x;
function f(x) = echo(g(x));

for(i=[0:10]){
    a= f(i);
}

Example 1[edit | edit source]

v=[4,7,9];
function result(x) = echo(result = x) x;
function f2(x, i = 0) = result(len(x) > i ? echo(str("x[",i,"]=",x[i])) x[i] + f2(x, i + 1) : 0);
echo("f2(v) = ", f2(v));
ECHO: result = 0
ECHO: "x[2]=9"
ECHO: result = 9
ECHO: "x[1]=7"
ECHO: result = 16
ECHO: "x[0]=4"
ECHO: result = 20
ECHO: "f2(v) = ", 20

Example 2[edit | edit source]


https://github.com/openscad/openscad/issues/2314

https://github.com/openscad/openscad/pull/1830

https://github.com/openscad/openscad/pull/1587

https://github.com/openscad/openscad/issues/1859


https://github.com/openscad/openscad/issues/2036

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/WIP#for_expression