I am confused. I did not go to programming school.
What happened to simple subroutines?
What is the simplest form of a Call
to replace an old fashion subroutine?
I don't need to pass anything.
if x is true gosub fixit
fixit:
stuff
return
Paul Lamar
Paul Lamar
subroutines
Re: subroutines
They are alive and well. The syntax that you referred to is the original Dartmouth Basic syntax (circa 1964) for calling subroutines. As you know, Dartmouth Basic did not allow parameters; data was "passed" to a subroutine by setting global variables (a practice very much frowned upon today - and for good reason). Later, the Basic language was made significantly more powerful when modern structured programming elements were introduced, at least as early as 1991 with the introduction of Visual Basic. (There could be earlier examples of Basic with structured programming elements.)Paul Lamar wrote:What happened to simple subroutines?
The simple program below shows how to define and invoke a parameterless subroutine.
Code: Select all
Dim v as Integer
Sub Main()
If (v > 3) Then
Call foo()
End If
End Sub
Sub foo()
v = 10
End Sub
Code: Select all
Dim v as Integer
Sub Main()
If (v > 3) Then
foo
End If
End Sub
Sub foo()
v = 10
End Sub
- Don Kinzer
-
- Posts: 65
- Joined: 14 May 2010, 16:01 PM
Thanks Don.
Looks simple enough.
Take a look at QB.
It had some nice features.
It was real time under DOS. I wrote a GPS driven moving map
program in it back in 1989. Of course it had all the file name
size and memory size limitations of DOS.
It was smart enough to automatically figure out data types.
Reduced the need for Dim. Memory is getting cheaper.
I still love it.
I like your ZBasic feature of 0.0 dimensioning Single.
BTW you could use a lot more examples in the
ZBasic Language Reference Manual for us Dick and Jane types.
Paul Lamar
Looks simple enough.
Take a look at QB.
It had some nice features.
It was real time under DOS. I wrote a GPS driven moving map
program in it back in 1989. Of course it had all the file name
size and memory size limitations of DOS.
It was smart enough to automatically figure out data types.
Reduced the need for Dim. Memory is getting cheaper.
I still love it.
I like your ZBasic feature of 0.0 dimensioning Single.
BTW you could use a lot more examples in the
ZBasic Language Reference Manual for us Dick and Jane types.
Paul Lamar
Quickbasic was a favourite of mine too - ran real quick too.
I have used so many dialects of basic over the years the syntax can be confusing. I still get caught out with MID not being MID$ a convention Vax basic used to signify which fucntions returned a string. If you are as old as me you may have played with Basic+ running under RSTS or pre-PC we had a compiler called BASCOM running on a Sirius and Apricot !
The Zbasic version is good and does a good job of picking up programming errors.
I have used so many dialects of basic over the years the syntax can be confusing. I still get caught out with MID not being MID$ a convention Vax basic used to signify which fucntions returned a string. If you are as old as me you may have played with Basic+ running under RSTS or pre-PC we had a compiler called BASCOM running on a Sirius and Apricot !
The Zbasic version is good and does a good job of picking up programming errors.