Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Modulus, Else If and some other comments

    Comments & Feedback
    4
    10
    532
    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.
    • Mincus
      Mincus F last edited by

      Modulus doesn't seem to have a %= counterpart, so:

      num += 1 // Works
      num %= 5 // Error with "unexpected ="
      num = num % 5 // Works
      

      Is this an intentional omission?

      I'm also wondering if there's any intention on improving complex program flow.
      Since there's no equivalent to a switch() (or CASE as it was in BBC BASIC, from long ago) and there's no implicit Else If, then things can look fairly messy.

      If condition Then
         foo()
      Else
         If condition2 Then
            bar()
         Else
            If condition3 Then
               foobar()
            EndIf
         EndIf
      EndIf
      

      Unless I've missed something and there's a neater way?

      Lastly, is there any way of adding some quicker movement around the editor? Something like control left/right for moving between words.

      N pianofire 2 Replies Last reply Reply Quote 1
      • N
        Nisse5 F @Mincus last edited by

        @Mincus IIRC, all these things have been covered in the wish list thread.

        Here's what I do as a replacement of a case statement:

        while true loop  // A "one-pass" loop
            if condition then foo() break endif
            if condition2 then bar() break endif
            if condition3 then foobar() break endif
            break
        repeat
        
        1 Reply Last reply Reply Quote 1
        • pianofire
          pianofire Fuze Team @Mincus last edited by

          @Mincus There doesn't seem to be anything in the pipeline at the moment but I am sure there will be a switch statement added at some point

          1 Reply Last reply Reply Quote 1
          • Mincus
            Mincus F last edited by

            Looking through the Wishlist thread (I should have done that first, my apologies, but it is long!) the Modulus hasn't been addressed.
            Using if statements in a list like that isn't great if your conditions are all checking the same variable, but there were some posts indicating we will get a switch() equivalent at some point.
            And I guess I'm just adding my voice to the list for more options to move around a file. Spending 30+ seconds holding left/right cursor keys isn't much fun!

            pianofire spikey 2 Replies Last reply Reply Quote 1
            • pianofire
              pianofire Fuze Team @Mincus last edited by

              @Mincus %= looks like an omission to me I will raise an issue

              1 Reply Last reply Reply Quote 0
              • spikey
                spikey F @Mincus last edited by spikey

                @Mincus Beside the pos1 and end keys, I started to use the control pad (or "directional button") more. Especially for selection and afterwards deleting of one line.

                Mincus 1 Reply Last reply Reply Quote 0
                • Mincus
                  Mincus F @spikey last edited by

                  @spikey Does the keypad do something special? I'm using a keypad-less keyboard, but I use the page up/down/home/end keys all the time.
                  The problem is when you need to do something in the middle of a 200 character line.
                  Maybe I should be making my lines shorter.

                  spikey 1 Reply Last reply Reply Quote 0
                  • spikey
                    spikey F @Mincus last edited by spikey

                    @Mincus sry, meant "control pad" on the controller not key pad. Moving the cursor with the controller moves it quicker after a few moments of pressing it and I like the copy/paste (instead of using the keyboard).

                    spikey 1 Reply Last reply Reply Quote 0
                    • Mincus
                      Mincus F last edited by

                      Found another instance of mod not being implemented:
                      If you do Vector % Vector you get an 'operation not recognized' error (Details: vector, modulo, vector)
                      For instance

                      v = { 20, 25 }
                      vmax = { 20, 20 }
                      v = v % vmax
                      

                      As a note to why I'm using these, it's the easiest way to manage screen wrapping in my Asteroids clone.

                      1 Reply Last reply Reply Quote 0
                      • spikey
                        spikey F @spikey last edited by

                        @Mincus sorry, was wrong about that. It just accelerates viewing not the cursor.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post