Board index » delphi » Qbasic & Pascal

Qbasic & Pascal

    ok, i just migrated to the Turbo Pascal (7.0) world.  Can anyone tell me
what's the MAJOR differences between the two?  A text/help file would be nice.

    By what i've learned, Qbasic seems to be EASIER.

And would anyone be as of so kind to post or email me commands in Qbasic and
their counterparts in Turbo Pascal?

Thanks, Scott.

 

Re:Qbasic & Pascal


Quote
Scott Phung (landm...@vcn.bc.ca) wrote:

:     ok, i just migrated to the Turbo Pascal (7.0) world.  Can anyone tell me
: what's the MAJOR differences between the two?  A text/help file would be nice.

:     By what i've learned, Qbasic seems to be EASIER.

: And would anyone be as of so kind to post or email me commands in Qbasic and
: their counterparts in Turbo Pascal?

: Thanks, Scott.

Scott,

  i did the same thing, probably because i didn't see anywhere to expand
in qbasic. the best thing (which is still pretty good for me) that i
wrote in qbasic is an analog clock, which runs nicely, except that i
didn't have the best video routines for speed. it runs very nicely
despite that error.
  one major difference between pascal(or c, and many
other langs) and basic is the fact that you don't (have to) declare
anything in basic. this leads to the BIG disadvantage in which you can't
do OOP  (at least to my knowledge) or have as big comprehension as far as
delcarations go, and usage of variables/types/constants. for instance, in
pascal, you can declare and define any array, like the following:

const
  CheckerBoard : array[1..8, 1..8] of byte = (
    (1, 0, 1, 0, 1, 0, 1, 0),
    (0, 1, 0, 1, 0, 1, 0, 1),
    (1, 0, 1, 0, 1, 0, 1, 0),
    (0, 1, 0, 1, 0, 1, 0, 1),
    (1, 0, 1, 0, 1, 0, 1, 0),
    (0, 1, 0, 1, 0, 1, 0, 1),
    (1, 0, 1, 0, 1, 0, 1, 0),
    (0, 1, 0, 1, 0, 1, 0, 1));

and manipulate it as to draw a checker board on the screen.  
  another thing is the direct-ness in which you can manipulate memory,
even with a simple syntax as mem[seg:offset], which improves the
operation of the language quite a bit. i'm sure there's a way to do it in
basic, although i never really went as far as to really learn much
syntax.
  another is the way you can use procedures/functions, and use them in
OOP. also, in basic, you can't pass a procedure as a parameter to a SUB,
or a FUNCTION. there's much more to this subject, although i haven't
gotten to all of it yet.
  one bad thing about pascal is the fact that in the "for" loops, there
isn't a "STEP" function built in. it's possible, and quite easy to make a
procedure that will replecate the behavior of it, using the ability to
pass procedures/functions to procedures/functions.
  and another, is the fact that you can use assembler. basic is too
indirect, and simple for assembler to be included, but it's very nice to
have that nice little "asm end;" ability.

that's all i want to type right now, but i'm sure many other people will
like to expand on this. :)

victor dods

Re:Qbasic & Pascal


Quote
Scott Phung (landm...@vcn.bc.ca) wrote:
>:     ok, i just migrated to the Turbo Pascal (7.0) world.  Can anyone tell me
>: what's the MAJOR differences between the two?  A text/help file would be nice.
>:     By what i've learned, Qbasic seems to be EASIER.
>: And would anyone be as of so kind to post or email me commands in Qbasic and
>: their counterparts in Turbo Pascal?
>: Thanks, Scott.
>Scott,

- Hello....

Here is a quick brief overview...

(Forget the GOTO and GOSUB - Commands, For The Most Part They No
Longer Exist.  The GOTO command does, but it is a very horrendous way
of programming)

(FOR .. NEXT LOOPS)

Basic

For I& = 1 To 100
... {Code Here}
Next I&

Pascal

Var I: Integer;         { Declare the variable }

For I := 1 To 100 Do    { Use the Do - Begin - End Blocks }
 Begin
 ... {Code Here}
End;

(IF..THEN LOOPS)

Basic

If A = B Then Goto Blablabla

If A = B Then
  DoSomething
 DoSeomthingElse
End if

Pascal

If A = B Then Blablabla { Instead of the GOTO, you call the
procedure/function directly - like when using line numbers }

If A = B Then           { Begin..End }
 Begin
  DoSomething
  DoSomething
End;

Etc..

If you want some more examples, give me actual questions and/or
examples of what you need.

Regards,

____________________
Rick Anthony - President
The DsGp SoftWare Company

IBM Team [OS/2]
IBM Business Enterprise Solutions Team

World Wide Web: http://www.tiac.net/users/dsgpsoft
E-Mail: dsgps...@tiac.net

Other Threads