Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,51 @@
'Keep in mind that this code DOES NOT follow appropriate coding structure, but is used for easiest explanation. That
'said, the following is both legal and executable.
a = 15 'Addressing the point raised regarding hiding complexity from the programmer, QB64 follows the QBasic/QuickBasic paradigm
'of not requiring the programmer to declare the type of a variable at all. In fact, variables can be used without any prior
'declaration or DIMensioning. So, in this way an undeclared variable is somewhat similar to a VOID in C/C++; however,
'unlike a VOID, the undeclared variable in QB64 DOES have a type, but the programmer need not be concerned with what it is.
Type c 'The closest to having Classes QB64 comes, being not OO, is user-defined types, which are containers of multiple
'values of same or different types. This is a declaration of a user-defined type named "c" which has the
'following elements:
d As Integer 'This is the declaration of variable "d", which is an element (notice the lack of the use of the word "member") of
'the user-defined type "c".
e As String 'As mentioned above the user-defined type, in this case "c", can have constituent elements of differing types.
End Type 'Notice that since this is a user-defined type and not an object, there are no methods defined within it. For this
'example defining a member of "c" as both a SUBroutine and a FUNCTION was attempted, neither of which was
'successful. It should also be noted that it is illegal to define a user-defined type without any elements. Put
'another way, all user-defined types require at least one element.
Type f 'As QB64 is not OO, it does not have true inheritence; however, the nesting of user-defined types is allowed, which
'allows for an attempt at inheritance, as close as QB64 can come. As well as pseudo-abstracting the type "c", which
'need not ever be directly accessed, although since instantiation occurs at declaration, memory allocation is most
'likely made for it.
g As c 'This is the declaration of a user-defined type as an element of another user-defined type. If "c" were used
'nowhere else in the program, but only here as a variable type, the pseudo-abstraction is achieved.
h As Integer
End Type
c.d = 25 'This is the way in which elements of user-defined types are accessed. Here the type "c" has been directly accessed
'and thus eliminates any such pseudo-abstraction as mentioned above.
Dim i As f 'This is the declaration of a variable of the user-defined type "f", which allows for the following.
i.g.e = "thirty five" 'This is the way in which the element of a user-define type containing another user-defined type as an
'element is access. In this way, user-defined type "f" has been pseudo-abstracted since its elements are
'never directly referenced in the rest of this program, even though memory has been allocated for it and its
'constituent elements.
Dim j As f 'This is a second instance of the user-defined type "f", showing that "f" has been pseudo-abstracted, even
'though "f" does exist in its own right in memory.
j.g.e = "forty five"
Print a
Print b
Print c.d
Print c.e
Print i.g.e 'This is another use of the previously declared variable "i" and its element "g"'s element "e".
Print g.e 'This is NOT a use of the above variable "i" or any of its elements. Since QB64 does not require strict typing
'nor contain a typeOf() function, it is unclear of what type "g.e" is, although it is suspected that it is either
'an Integer or a String, being a use of type "c"'s element "d" or "e".
Print j.g.e
System