Turbo Basic - Code Example

Code Example

The following program is an example of the ALGOL-like BASIC dialect that Turbo Basic supported. Unlike traditional BASIC, which used line numbers and had limited control structures and no support for ALGOL-like subroutines, modern BASIC dialects starting at this period were extended to make the language compatible with modern structured programming theory by discarding the line numbers and adding the control structures and subroutine definitions needed by structured programming.

INPUT "What is your name?: ", n$ PRINT "Hello "; n$ DO s$ = "" INPUT "How many stars do you want to print"; s FOR i = 1 TO s s$ = s$ + "*" NEXT i PRINT s$ DO INPUT "Do you want to print more stars"; q$ LOOP WHILE LEN(q$) = 0 q$ = LCASE$(LEFT$(q$, 1)) LOOP WHILE q$ = "y" PRINT "Goodbye "; n$

Note that s$ is a string and s is a single precision floating-point (number). They are separate variables.

Like the other Borland products of this era, the code executes within the integrated development environment.

Read more about this topic:  Turbo Basic

Famous quotes containing the word code:

    ...I had grown up in a world that was dominated by immature age. Not by vigorous immaturity, but by immaturity that was old and tired and prudent, that loved ritual and rubric, and was utterly wanting in curiosity about the new and the strange. Its era has passed away, and the world it made has crumbled around us. Its finest creation, a code of manners, has been ridiculed and discarded.
    Ellen Glasgow (1873–1945)

    Acknowledge your will and speak to us all, “This alone is what I will to be!” Hang your own penal code up above you: we want to be its enforcers!
    Friedrich Nietzsche (1844–1900)