Q(uick)BASIC Statement: BEEP

Quick View

BEEP Statement

A device I/O statement that sounds the speaker

Worth knowing

Useful and cross-version information about the programming environments of QBasic and QuickBasic.

Syntax
  • BEEP
Description/Parameter(s)

Generates a beep sound from your computer's speaker.

Syntax
  • BEEP
Description/Parameter(s)

The BEEP statement makes a sound through the loudspeaker. This statement makes the same sound as the following statement:

  • PRINT CHR$(7)
Example

The following example uses BEEP to indicate an error in the response:

CLS ' Clear the screen DO INPUT "Hear a beep (Y or N)"; Response$ R$ = UCASE$ (MID$ (Response$,1,1)) IF R$ <> "Y" OR R$ = "N" THEN EXIT DO BEEP LOOP
Syntax
  • BEEP
Description/Parameter(s)

The BEEP statement makes a sound through the loudspeaker. This statement makes the same sound as the PRINT CHR$(7) statement.

Example

This example uses the BEEP statement to indicate an error in the response.

CLS 'Clear the screen. DO INPUT "Hear a beep (Y or N)"; Response$ R$ = UCASE$(MID$(Response$, 1, 1)) IF R$ <> "Y" OR R$ = "N" THEN EXIT DO BEEP LOOP