# BASIC

To use this language, use the class "language-basic".

Note: this component focuses on first and second-generation BASICs (such as MSX BASIC, GW-BASIC, SuperBASIC, QuickBASIC, PowerBASIC...).

## Comments

    ! This is a comment
    REM This is a remark

## Strings

    "This a string."
    "This is a string with ""quotes"" in it."

## Numbers

    42
    3.14159
    -42
    -3.14159
    .5
    10.
    2E10
    4.2E-14
    -3E+2

## Dartmouth Basic example

    5 LET S = 0
    10 MAT INPUT V
    20 LET N = NUM
    30 IF N = 0 THEN 99
    40 FOR I = 1 TO N
    45 LET S = S + V(I)
    50 NEXT I
    60 PRINT S/N
    70 GO TO 5
    99 END

## GW-BASIC example

    10 INPUT "What is your name: ", U$
    20 PRINT "Hello "; U$
    30 INPUT "How many stars do you want: ", N
    40 S$ = ""
    50 FOR I = 1 TO N
    60 S$ = S$ + "*"
    70 NEXT I
    80 PRINT S$
    90 INPUT "Do you want more stars? ", A$
    100 IF LEN(A$) = 0 THEN GOTO 90
    110 A$ = LEFT$(A$, 1)
    120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30
    130 PRINT "Goodbye "; U$
    140 END

## QuickBASIC example

    DECLARE SUB PrintSomeStars (StarCount!)
    REM QuickBASIC example
    INPUT "What is your name: ", UserName$
    PRINT "Hello "; UserName$
    DO
       INPUT "How many stars do you want: ", NumStars
       CALL PrintSomeStars(NumStars)
       DO
          INPUT "Do you want more stars? ", Answer$
       LOOP UNTIL Answer$ <> ""
       Answer$ = LEFT$(Answer$, 1)
    LOOP WHILE UCASE$(Answer$) = "Y"
    PRINT "Goodbye "; UserName$

    SUB PrintSomeStars (StarCount)
       REM This procedure uses a local variable called Stars$
       Stars$ = STRING$(StarCount, "*")
       PRINT Stars$
    END SUB

## Known failures

There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter. However, Prism dares to be open and honest about them. If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.

### Two double quotes inside a comment

    ! This "comment" is broken
    REM This "remark" is broken