multiline functions

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

multiline functions

vincent_mathoscope

hi
if my function has several lines
say f(x) is calculated by :

what is the syntax in openscad ?
i dont really understand where to whatch here to have the answer :
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/User-Defined_Functions_and_Modules#Functions



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: multiline functions

tsingi
Your function body didn't make it through.

On Mon, May 14, 2018 at 11:24 AM, vincent_mathoscope <[hidden email]> wrote:

hi
if my function has several lines
say f(x) is calculated by :

what is the syntax in openscad ?
i dont really understand where to whatch here to have the answer :
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/User-Defined_Functions_and_Modules#Functions



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



--
"Rumors of my death have been greatly exaggerated."
  -- Jesus Christ

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: multiline functions

NateTG
In reply to this post by vincent_mathoscope
Roughly speaking, the function goes from the spot where you have "function"
until there's a semicolon.


You can check the manual for examples (like the one for quicksort) that
might clarify things.



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: multiline functions

nophead
A function in openscad is an expression. That can be as long as you want but you can't have statements like other languages. You can use let() to assign sub expressions to variables and ? : to have conditionals.

On 14 May 2018 at 17:15, NateTG <[hidden email]> wrote:
Roughly speaking, the function goes from the spot where you have "function"
until there's a semicolon.


You can check the manual for examples (like the one for quicksort) that
might clarify things.



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org