Close



Results 1 to 10 of 72

Hybrid View

  1. #1
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    Quote Originally Posted by old man emu View Post
    What is the meaning or function of:

    1. the round brackets - Difference () Union ()
    2. Wiggly brackets {lines of code}
    3. stuff inside square brackets [ ]

    I know that // indicates a coder's comment that does not get read when the code is run.
    OpenScad evolved and was never really well thought out in advance. The syntax of the language shows that. They wanted it to look like C but the fundamentals of the language are different. OpenScad does not even allow variables to change value during 'execution'. The parts of the language where it looks like that is happening are not real. For example the 'for' loops. The compiler is just in-line compiling the code blocks with different values of the index 'variable'.

    Probably, the round brackets on Difference() and Union() are just to denote that you are performing a 'function'. But that deviates from their usage in C where you are passing in parameters within the ().

    The square brackets are more consistent. If you see square brackets [], the contents is going to be used as a vector (or a point).

    OpenScad is a great tool. But IMHO it is an abomination from a syntax perspective. Just as people study different spoken languages to understand how one language or dialect evolved from another and influenced thought on this subject or that one... OpenScad provides a Computer Language equivalent. Somebody could write a PhD thesis on the subject.

    The syntax is chaotic and a mess.... (But I do like OpenScad!!!!)

  2. #2
    Staff Engineer old man emu's Avatar
    Join Date
    Oct 2013
    Location
    Narellan, New South Wales, Australia
    Posts
    912
    Thanks for those comments, but I think I asked the wrong question to get the answer I needed.

    The more correct questions would be:

    1. What does each type of bracket enclose, and what is the order of precedence?
    2. What would the example read like if it was written like a paragraph of text in a novel? In other words, what is the long hand version of this?

    OME

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •