none
Local variables, parameters and return values in Small Basic

    General discussion

  • The use of local variables and parameter passing makes programming more secure and less error prone and would be extremely useful when using a subroutine library, as proposed by Nonki. Unfortunately, they are not supported in SB.

    However, they can be mimicked, as can the passing of parameters into a subroutine and the return of a value from it. You just need to follow a few simple conventions. Here is a tutorial on how you can do it:

    PP Code Tutorials

    Thursday, March 23, 2017 5:11 PM

All replies

  • outbyone,

    That's a good write-up which does capture a unique way of creating local variables and passing parameters. Thanks for sharing with us.


    JR

    Friday, March 24, 2017 12:23 AM
    Answerer
  • Hello outbyone.

    Thank you for your information.  How to save variables as local variables in Small Basic.   That is an important question for Small Basic users.

    • I sometimes use an array like local["x"] after saving like Stack.Push("local", local).  But the program will become longer, not simple and slower.
    • Or just x after Stack.Push("local", x).
    • Or use _x, xx or lx and so on.  Anyway, use any name that is not conflict to others.
    • To use other languages which have local variables is another solution, I think.

    Nonki Takahashi

    Wednesday, April 05, 2017 5:50 AM
    Moderator