We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SmallBasic Open Edition
#11
Hello everyone.

I know I shouldn't remember these anymore, but back in the day when I got excited about programming, the options for home computers were GWBasic, BASICA or MSX-Basic.

Pascal and C and a few others had of course already appeared, but 95% of the home programmers of that time used Basic.

For example, in GWBasic, the type of variables was indicated right at the end of the name.

Code:
$: String variable
%: Integer variable
!: Single-precision variable
#: Double-precision variable


Regarding naming, there were otherwise very much the same rules as now in SmallBasic. And the Basics of that time didn't require variables to be initialized separately anyway, instead a variable could be activated by simply entering a value for it. And if I remember correctly, a variable that wasn't even created yet always gave a value anyway. String "" and numeric variables with a value of 0.

As long as the size of the code remains in the tens or at most a couple of hundred lines, this is usually not a problem. But as the program grows, it very soon becomes a problem.

I started to make the game described above, where the player was controlled in a changing environment while the computer-controlled guys moved there. In the game, you could shoot with a few different weapons, the field of view was limited by the walls etc. in the terrain.

SmallBasic would have been able to function as an engine in that game, but the programmer, i.e. me, simply lost my nerve. Naming variables and tables took more time and effort (read pain) than figuring out the calculation needs of the game engine itself. The fact that all variables were always globally visible made it worse.

Programming is the same, whether you use Basic, C or even JavaScript. It is "talking" to the computer in a specific language. And the majority of languages work very much the same way.

In my opinion, perhaps too much is being thought about today, which is the best language for a beginner. I think the whole question is completely wrong. One should ask "how do we teach logical and mathematical thinking to a person interested in programming?"

I personally like the way variables are used in JavaScript. They must be initialized separately and followed by the suffix "$", but the type of the variables is free. That is, the same variable can be either a string, double, integer or even an object.

Probably some sort of hybrid model would be best, at least initially.

Option SB at the beginning of the code would try to emulate SmallBasic as best as possible. A bit like, for example, FreeBasic can be used in different "modes" by entering parameters to the compiler. Even if "-lang qb".

Code:
#option SB
a = 1
MySub()
TextWindow.WriteLine(a)
Program.End
Sub MySub
  a = a + 1
EndSub

Output: 2

Without the option, things wouldn't work the same way.

Code:
a = 1
MySub()
TextWindow.WriteLine(a)
Program.End
Sub MySub
  a = a + 1
EndSub

Output: 1

MySub does not have visibility into the variable 'a' named in the main program, so it creates a new variable for itself with an initial value of 0. When returning from the subprogram, the original variable a is used.

But I still have some work to do to get the error checking done, bug fixes and variable typings right with the library, so these thoughta can be left to simmer in the background for now.

However, it's nice to note that there are still enough enthusiastic people around SmallBasic.
[-] The following 1 user Likes KristianVirtanen's post:
  • AbsoluteBeginner
Reply


Messages In This Thread
SmallBasic Open Edition - by KristianVirtanen - 10-13-2024, 04:41 PM
RE: SmallBasic Open Edition - by KristianVirtanen - 10-13-2024, 08:55 PM
RE: SmallBasic Open Edition - by litdev - 10-14-2024, 08:35 AM
RE: SmallBasic Open Edition - by z-s - 10-14-2024, 09:02 AM
RE: SmallBasic Open Edition - by KristianVirtanen - 10-14-2024, 10:59 AM
RE: SmallBasic Open Edition - by z-s - 10-14-2024, 04:39 PM
RE: SmallBasic Open Edition - by KristianVirtanen - 10-14-2024, 05:57 PM
RE: SmallBasic Open Edition - by Scout - 10-15-2024, 09:11 AM
RE: SmallBasic Open Edition - by litdev - 10-15-2024, 12:46 PM
RE: SmallBasic Open Edition - by Scout - 10-15-2024, 03:44 PM
RE: SmallBasic Open Edition - by KristianVirtanen - 10-15-2024, 07:27 PM
RE: SmallBasic Open Edition - by KristianVirtanen - 10-18-2024, 08:41 AM
RE: SmallBasic Open Edition - by litdev - 10-18-2024, 12:21 PM
RE: SmallBasic Open Edition - by jrmrhrb00 - 10-18-2024, 03:52 PM
RE: SmallBasic Open Edition - by KristianVirtanen - 10-18-2024, 08:13 PM
RE: SmallBasic Open Edition - by z-s - 10-19-2024, 02:28 AM
RE: SmallBasic Open Edition - by litdev - 10-19-2024, 10:49 AM
RE: SmallBasic Open Edition - by KristianVirtanen - 10-19-2024, 12:53 PM
RE: SmallBasic Open Edition - by z-s - 10-19-2024, 03:47 PM
RE: SmallBasic Open Edition - by KristianVirtanen - 10-20-2024, 08:59 AM
RE: SmallBasic Open Edition - by KristianVirtanen - 10-25-2024, 08:54 PM
RE: SmallBasic Open Edition - by KristianVirtanen - 11-05-2024, 06:37 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)