sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Upgrade NotePad++?

    Scheduled Pinned Locked Moved Developers' Forum
    16 Posts 5 Posters 1.8k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thomthomT Offline
      thomthom
      last edited by

      Does the { ... } syntax work instead of do ... end?

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • M Offline
        MartinRinehart
        last edited by

        @thomthom said:

        Does the { ... } syntax work instead of do ... end?

        Yes, but braces are a B to type unless you've spent too many years writing a C-derivative language.

        Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          Or if you're on a Norwegian Keyboard Layout. Then they are accessed by AltGr+7/0 which is not a friendly key combo. I switch to English layout when I code.

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            I think you might not need the "do" in there. I don't use that syntax ever, but looking at the Programming Ruby manual, it does not use "do" in its example. Give that a shot,

            Chris

            PS I use the:
            entities.each do |e| ...code... end

            syntax

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              Not sure about other non-English layouts, but Norwegian layout sure isn't friendly for programmers. http://en.wikipedia.org/wiki/Keyboard_layout#Norwegian

              Before using Ruby I've used Javascript, PHP, CSS and C# which also use curly bracket - so I got sued to it. But after switching to English layout I feel it flows better. And I like my curly brackets. πŸ˜„ Though, the very first language I tried was Visual Basic 5.0 - at that time, curly brackets looked dark and mysterious. πŸ˜•

              Hey! - it is that off-topic time again? 😳

              Thomas Thomassen β€” SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                I always use NotePad++.
                You probably noticed I often use stuff like entities.each{|e|...}: I hadn't appreciated that {...} were so difficult to type on some non-English keyboard layouts !

                TIG

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  And oddly Martin has not even come by to see if my fix worked for him....I guess he's away from his keyboard this afternoon (or evening or whatever).

                  Chris

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    MartinRinehart
                    last edited by

                    @chris fullmer said:

                    I guess [Martin]'s away from his keyboard this afternoon (or evening or whatever).Chris

                    Mornings are my thing.

                    I'm doing the tutorial. for e in entities do ... end strikes me as a lot more beginner-friendly than entities.each { |e| ... }. Guess I'll have to try some editors.

                    There's an old saying, something like: "An editor a day keeps the productivity away."

                    Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

                    1 Reply Last reply Reply Quote 0
                    • Chris FullmerC Offline
                      Chris Fullmer
                      last edited by

                      But I think your usage of " do" might be incorrect syntax in any ruby editor. It looks like the do should not be included with the for loop.

                      301 Moved Permanently

                      favicon

                      (www.ruby-doc.org)

                      Chris

                      Lately you've been tan, suspicious for the winter.
                      All my Plugins I've written

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by

                        hm.. it does look like the do is redundant in for ... in syntax... But Ruby doesn't throw any errors...

                        Thomas Thomassen β€” SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • M Offline
                          MartinRinehart
                          last edited by

                          Tried SciTE. Excellent text editor. High marks for ".properties" files, one per language, that make it easy to customize.

                          Downside: exact same bug as NotePad++.

                          The two forms of for/in that load without errors are:

                          
                          for x in foo do ... end
                          
                          for x in foo # no do
                              ...
                          end
                          
                          

                          Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

                          1 Reply Last reply Reply Quote 0
                          • J Offline
                            Jim
                            last edited by

                            That's odd because NPP and Scite (as well as many others) are based in the same editor core Scintilla.

                            Hi

                            1 Reply Last reply Reply Quote 0
                            • thomthomT Offline
                              thomthom
                              last edited by

                              Odd? They both use Scintilla and both have the same syntax issues?

                              Thomas Thomassen β€” SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              1 Reply Last reply Reply Quote 0
                              • J Offline
                                Jim
                                last edited by

                                Oh sorry - I mis-read Martin's post.

                                Hi

                                1 Reply Last reply Reply Quote 0
                                • Chris FullmerC Offline
                                  Chris Fullmer
                                  last edited by

                                  I guess I would recommend using it without the do, since ruby syntaxd seems to think its redundant (which I do find odd as it does not fit their other loop syntaxes).

                                  Or if it helps, I learned the array.each do |e| ... endmethod first and I was able to understand it fairly quickly. And I hve zero programming experience outside of Ruby for Sketchup.

                                  Another bonus to teaching that method is that all the API uses it, as apposed to the for in end loop. So it might help readers transition into the API smoother. But that is just a thought,

                                  Chris

                                  Lately you've been tan, suspicious for the winter.
                                  All my Plugins I've written

                                  1 Reply Last reply Reply Quote 0
                                  • 1 / 1
                                  • First post
                                    Last post
                                  Buy SketchPlus
                                  Buy SUbD
                                  Buy WrapR
                                  Buy eBook
                                  Buy Modelur
                                  Buy Vertex Tools
                                  Buy SketchCuisine
                                  Buy FormFonts

                                  Advertisement