Navigation

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

    Goto Function?

    General Discussion
    7
    11
    505
    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.
    • Martin
      Martin Fuze Team last edited by

      Try using functions instead

      1 Reply Last reply Reply Quote 0
      • Jonboy
        Jonboy Fuze Team last edited by

        Hi, as there is no use of line numbers other than a reference for error checking so GOTO is very much redundant.
        I will miss:
        10 PRINT "DIXONS STAFF ARE RUBBISH"
        20 GOTO 10

        Now we use user functions.

        My programs for example generally look something like this:

        cards = [.heart = [], .diamond = [], .club = [], .spade = [] ]
        player = 0
        computer = 0
        
        setup() // jump to a routine called setup
        
        loop // the main loop
              clear() 
              checkInput() // my own function to check the controls
              updateScreen() // my own function to draw everything to the screen
              update() // the system command to update the screen display
        repeat
        
        function checkInput()
        return void 
        
        function updateScreen()
        return void 
        
        function setup()
              // set up my main variables, load images and basically dump all the config stuff here
              //load graphics etc. 
              //load sounds
              //assign structures and arrays
        return void // void is nothing
        

        In the old BASIC days, and specifically with BBC BASIC you would know this as procedural programming - each subroutine being a PROC routine.

        This is exactly the same same as user functions and basically an advanced version of GOSUB. The difference is that you can pass information to a function and return results back at the same time - the same as DEF FN in some versions of BASIC but all combined into one.

        Once you have gone procedural / user functions, you'll never look back.

        Sorry, went on longer than expected!

        1 Reply Last reply Reply Quote 5
        • W
          wxscooter last edited by

          Useful info. We'll have to go the function route... :) Thanks!

          1 Reply Last reply Reply Quote 0
          • ITzTravelInTime
            ITzTravelInTime F last edited by ITzTravelInTime

            goto in modern programming languages is no longer a good practise and can procude really bad results if missused, so better to not have it so poeople new to programming and starting with fuze will not learn that, ok it's sad not having this historyc basic feature, but teaching newcomers proper modern programming is more important

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

              Functions replace Gosub, I'd say that the loop and repeat keywords replace Goto.

              so instead of
              10 PRINT "Hey That's Great"
              20 GOTO 10

              it's
              loop
              print ("Hey That's Great\n")
              repeat

              Although I get mixed up with qbasic having that be do loop (or while wend in even earlier microsoft basics) instead of loop repeat. Not sure why that had to be different.

              1 Reply Last reply Reply Quote 0
              • A
                Ancientspark F last edited by

                I have the same sentiment coming from that same school with QBasic.. I think that in today's society to relate yourself to being too much similar to BASIC is a henderance to C/C++ snobs who won't hear anything of it and were "lucky" enough to be born with a silver compiler in their tongue and take 4 times as many lines just to print "Hello World" while loading their INCLUDE libraries...

                So BASIC has a stigma and ANY new language must relate itself more steadfastly to the likes of Python and Javascript perhaps to gain the attention that Fuse definately has ever AS it IS in fact, a TAD closer to BASIC than most would like to admit.

                1 Reply Last reply Reply Quote 0
                • A
                  Ancientspark F last edited by

                  On that note, I invite ANY old QBASIC "fool" to go to qb64.org and get a free copy of the 64-bit compiler built ON QBASIC and yet boasting rich HI-DEF GRAPHICS AND ELASTIC WINDOW-ABLE MODES, FULL MP3 SOUND SUPPORT WITH A FEW LINES ONLY... also loads NORMAL JPG images as well!! more intuitive mouse control as well. It's FAR more advanced and yet LOOKS exactly the same.. it is a full compiler so you WILL compile EVERY time before running.. but it is in fact written in C/C++ to begin with so.. there's THAT. LMAO.

                  1 Reply Last reply Reply Quote 0
                  • Hitomi
                    Hitomi F last edited by

                    I think Freebasic is a good new version of basic. It doesn't get as much attention though.

                    1 Reply Last reply Reply Quote 0
                    • pianofire
                      pianofire Fuze Team last edited by

                      Was just reminded of this

                      https://imgs.xkcd.com/comics/goto.png

                      1 Reply Last reply Reply Quote 5
                      • A
                        Ancientspark F last edited by

                        HAHAHHAA!! That's awesome.

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