please add SUB routines if possible...

2008-05-20
2013-04-04
  • Andre Krause
    Andre Krause
    2008-05-20

    hello, it would be really great if it would be possible to add simple subroutines. i want to use kidbasic in an introductory course to programming for sport students.

    something like this:

    FUNCTION add(a,b)
       return a+b
    END FUNCTION

    or

    SUB draw(x,y)
       circle x,y, 100
    END SUB

     
  • Slym
    Slym
    2009-09-15

    I'd like it, too.

     
  • Subroutines exist via the GOSUB and RETURN commands and labels.

    gosub mySub
    mySub:
      a = a + 3
      print a
      return
    
     
  • I think, these requests were specifically about providing support for subroutines ARGUMENTS, no?

     
  • Jim Reneau
    Jim Reneau
    2010-08-11

    The architecture of the interpreter makes this quite a difficult task.  BASIC-256 was created to be a first step in learning to program.  Real functions and subroutines exist in VB, Python, and Mathpiper (three solutions for the second language).   We are trying to keep BASIC-256 simple (common variable scope) and two (three internally) variable types.

     
  • Jeff Smith
    Jeff Smith
    2013-04-02

    Adding more ideas that are not BASIC? That does not sound like it belongs in a BASIC environment. If you justified that then you have to also add structures, enumerations, pointers, classes and objects… and of course we have a big mess. In fact the biggest problem I've observed is that the longer students keep advancing with only the BASIC syntaxt, the more difficulty they have graduating to other languages even though the concepts were paralelled.

    To teach thorough programming skills I think it best to say up front that different languages have more ways that make certain concepts easier. I'd include more than one language in the cirriculum to demonstrate.