Permanently Deleted

        • JuneFall [none/use name]
          ·
          4 years ago

          BASIC can be good if people did not have programming experience, as in BASIC you have nice GOTO instructions. Those are horrible style, but enable new programming people quite easily to simulate the assembler and machine level instructions which make loops and such.

          10 REM This is a basic loop to sum up the numbers from 1 to 10 
          20  LET LOOPVARIABLE = 1
          21  LET SUM = 0
          22  LET LIMIT = 10
          30 LOOP:
          40  IF LOOPVARIABLE > LIMIT THEN GOTO ENDOFLOOP 
          50  LET SUM = SUM + LOOPVARIABLE
          60  LET LOOPVARIABLE = LOOPVARIABLE + 1
          70  GOTO LOOP 
          80 ENDOFLOOP:
          90  PRINT SUM 
          

          Is more or less functionally equivalent to some python thing:

          limit = 10
          sum = 0
          for i in range(1,limit+1):
            sum += i
          print(sum)
          

          Which can easily become a function itself (and return sum instead of print it). At the QBasic level you can make the housekeeping checks explicitly, this is sometimes good for new programmers as the flow of execution is clear. That is something some new programmers struggle with.

          C is a good compromise but confuses some with its archaic syntax on semicolon endings. It highlights what will happen in the loop quite well, but it isn't quite as verbose as possible with QBasic. Honestly, after you got the concepts of variables, loops, conditions and functions most programming languages are (even for the beginner) easily exchangeable. If you struggle with concepts for those it helps to have a level of abstraction which enables you to build an own model on one hand or to be so low level that one could show you how the flow of execution is built.

          int sum = 0
          for( int i = 1 ; i < 10+1 ; i++ ){
            sum += i;
          }
          

          In my opinion depending on the course and how it is done it is more apt to just use modern high programming languages which do a lot of things for you, but for some people the concepts will be unclear.