Qbasic common commands
What you said is a common command, let me tell you:

Declaration of cession

Format: [LET] variable = expression

Function: Calculate the expression on the right first, and then assign the result to the variable on the left.

Variable value exchange report

Format: exchange variable 1, variable 2.

Function: Exchange the values of variable 1 and variable 2.

Print (display or output statements)

Format: Print [Expression Table] [,|; ]

Function: Display the specified data on the screen.

Print report

Format: LPRINT[ expression table] [,|; ]

Function: Print the specified data with a printer.

Comment statement

Format 1: REM comment content

Format 2:' Comment content

Function: explain in the program, explain the function of the program segment.

END (end statement)

Format: End

Function: End a program.

CLS (clear screen statement)

Format: CLS

Function: Clear the information displayed on the screen.

Print Use (optional display format statement)

Format: Print with "Format String"; [; ]

Function: Display the data in the expression table on the screen according to the format specified by the format string.

LPRINT USING (print format statement)

Format: l Print using < "format string" >; [; ]

Function: Print the data in the expression table on the printing paper according to the format specified by the format string.

Stop (pause statement)

Format: Stop

Function: Pause the execution of the program.

Sleep (timed pause statement)

Format: Sleep [Numerical Expression]

Function: Pauses the execution of the program within the value (seconds) specified by the numeric expression.

Input (keyboard input statement)

Format: Enter [; ; ] ["Annotation content"] [; |,] variable [,variable]

Function: provide data to each variable in the input statement in turn through the keyboard.

Line input (line input statement)

Format: lineinput [; ] ["Annotation content"; ] string variable

Function: Assign strings (up to 255) entered on the keyboard to string variables.

Read/Data (read/set statement)

Format: read variable [,variable] …

Data constant [,constant] ...

Function: the READ statement assigns the DATA provided in the data statement to the specified variables in turn.

Recovery (recovery data area statement)

Format: Restore [Line Number | Line Label]

Function: reads a constant from the specified data statement line.

Numerical function

sine function

Format: SIN (X)

Function: find the sine function value of x.

cosine function

Format: COS(X)

Function: find the cosine function of x.

Tangent function

Format: Tan (x)

Function: find the tangent function of x.

ATN (arc tangent function)

Format: ATN(X)

Function: find the arc tangent function value of X.

SQR (Square Basic Function)

Format: SQR(X)

Function: Find the arithmetic square root of x, where x must be greater than or equal to zero.

exponential function

Format: EXP(X)

Function: Find the power of x according to e, e = 2.75438+08282.

LOG (logarithmic function)

Format: log (x)

Function: find the natural value based on e, that is, the value in x.

SGN (symbolic function)

Format: SGN(X)

Function: find the sign of the independent variable X.

Absolute value function

Format: ABS(X)

Function: Find the absolute value of the independent variable x, that is |X|.

INT (integer function)

Format: INT(X)

Function: take the largest integer not greater than x value.

FIX (truncated integer function)

Format: fixed (x)

Function: use decimal to remove the decimal part of a number and intercept the integer part directly without rounding. The independent variable x can be any numerical expression.

CINT (for integer functions)

Format: CINT(X)

Function: Convert a number with a decimal to an integer and round the decimal part.

CLNG (for long integer functions)

Format: CLNG(X)

Function: Converts the independent variable x into an integer.

Single precision function

Format: CSNG(X)

Function: Convert the numerical value x into a single-precision number, where the independent variable x is a numerical expression, and use this function to convert it into a single-precision number.

CDBL (double precision function)

Format: CDBL(X)

Function: Converts the numerical value x into a double-precision number, and the independent variable x can be any numerical expression.

RND (random function)

Format: RND(X)

Function: Generate a random number from 0 to 1.

Timer (? Function)

Format: Timer

Function: Starting from midnight.

ASCII (ASCII code function)

Format: ASC(X$)

Function: returns the ASCII code of the first character of the string X$

VAL (string-to-value function)

Format: VAL(X$)

Function: Converts the string X$ to a numeric value.

LEN (length measurement function)

Format: LEN(X$)

Function: Measure the length of a string, that is, the number of characters in the string.

Substring retrieval function

Format: INSTR([N,] X$, Y$)

Function: Returns the first occurrence of the string Y$ in the string X$.

Three functions commonly used in screen display format

Tab (? Function)

Format: tab (x)

Function: display or print the required information at the specified position X.

SPC(? Function)

Format: SPC(X)

Function: clear x spaces

SPACE$(? Function)

Format: space $(N)

Function: Returns a string of n spaces.

Input function

INKEY$(? Function)

Format: INKEY$

Function: read characters from the keyboard

Enter $ (? Function)

Format: enter $ (N[, [#] document number])

Function: Returns a string of n characters read from the keyboard or a specified file.

Cursor line coordinate function

Format: CSRLIN

Function: Returns the coordinate position of the current cursor line.

Cursor bar coordinate function

Format: location (n)

Function: Return the current cursor bar coordinate position.

UBOUNDLBOUND (test subscript upper and lower bound function)

Format: UBOUND (array [,dimension])

LBOUND (array [,dimension])

Function: Returns the upper and lower bounds of the specified dimension in the definition array.

FRE (test null byte function)

Format: FRE(X)

Function: Returns the number of free memory segments.

switch to

Format: Go to Line Identifier

Function: change the execution order of the program and unconditionally switch to the execution of the line identifier indicated after GOTO.

ON/GOOT

Format: ON expression goes to row identifier table.

Function: first calculate the value of the expression after on, and then transfer the program to a row identifier in the row identifier table pointed by GOTO for execution according to the calculation result.

relational operation

= (equal to)

& gt (greater than)

& gt= (greater than or equal to)

& lt (less than)

& lt= (less than or equal to)

& lt& gt (not equal to)

And (and)

Or (or)

No (not)

Table: A B | NOT A | NOT B | A and B | A or b

1 1 | 0 | 0 | 1 | 1

1 0 | 0 | 1 | 0 | 1

0 1 | 1 | 0 | 0 | 1

0 0 | 1 | 1 | 0 | 0

Logical operation order: NOT AND OR

()-Arithmetic-Relation-Logic

IF (conditional statement)

Single-line IF conditional statement

Format: If there are conditions, the statement sequence 1 [ELSE statement sequence 2]

Function: first calculate the value of the condition. If true, the statement sequence 1 is executed after it, otherwise, the statement sequence 2 is executed after ELSE.

Block structure of IF conditional statement

Format: If the condition 1

[Statement Block 1]

Then condition 2

[Statement Block 2]

……

[Otherwise.

[statement block n]]

If ... it will be over.

CASE (conditional statement)

Format: Select Case Test Expression

Case expression table 1

[Statement Block 1]

[Case Expression Table 2]

[Statement Block 2]]

……

[Other circumstances]

[statement block N]]

End selection

Function: according to the value of the expression, select a qualified statement block from multiple statement blocks to execute.

FOR/NEXT (loop statement)

Format: For A=E 1 step E3 to E2.

Circulating body

Next a

Description: The FOR statement is a loop description statement, indicating the number of loops. Because TO STEP is a statement definer.

A loop control variable can be expressed by any simple variable.

E 1-Initial value of loop control variable

E2-Final value of loop control variable

E3-Increment of loop control variable, also called step size.

The next statement is a loop terminal statement, which must appear in pairs with the FOR statement. The loop control variables in the next statement must be consistent with those in the FOR statement.

The loop body consists of one or more statements, which is the part of repeated execution.

WHILE/WEND (loop statement)

Format: while

Circulating body

line

Description: WHILE is the beginning statement of the loop, also known as the explanation statement. Its function is to give the loop condition that WEND is the end statement of the loop.

& ltConditions > represents a logical condition, which can be a relational expression, a logical expression, a variable or a constant.

DO/LOOP (loop statement)

Format 1: DO[(WHILE or UNTIL) condition]

Circulating body

[exit from DO]

ring

Format 2: DO

Circulating body

[exit from DO]

Loop [(WHILE or UNTIL) condition]

Description: If the condition is always a DO-LOOP loop loop, you may fall into an "infinite loop". At this point, you can use EXIT DO to exit the loop.

DO loops can be nested, and their rules are the same as FOR-NEXT loops.

String processing function

CHR$ (character function)

Format: Canadian dollar (n)

Function: Converts the ASCII code value n into the character it represents.

MID$ (intermediate string function)

Format: MID$ (A$, N [,M])

Function: extract m characters from the nth character of the string A$

String $

Format 1:STRING$(N, x)

Function: generate n characters corresponding to ASCII code X, which is usually used for characters that cannot be input by keyboard keys.

Format 2: String $(N, X$)

Function: Generate the first character in n strings X$

OCT$ (decimal to octal function)

Format: OCT$ (X)

Function: Converts a decimal value to an octal string.

STR$ (numeric value converted to string function)

Format: STR$ (X)

Function: Converts numeric data into string data.

Lslim $ (function to delete the left space of the string)

Format: LTRIM$ (X$)

Function: Delete the space to the left of the string X$

RTRIM$ (a function that removes spaces on the right side of a string)

Format: RTRIM$ (X$)

Function: Delete the space to the right of string data X$

LCASE$ (lowercase function)

Format: LCASE$ (A$)

Function: change all uppercase letters in $ to lowercase.

UCASE$ (uppercase function)

Format: UCASE$(A$)

Function: change all lowercase letters in A$ to uppercase.

TRIM$ (binary truncated function)

Format: TRIM$ (A$)

Function: Truncate all spaces at the beginning and end of the string A$

LEFT$ (left function)

Format: left $(A$, n)

Function: Get the leftmost n characters of the string A$

Right $ (right function)

Format: right $(A$, n)

Function: Get the rightmost n characters of the string A$

HEX$ (decimal number converted into hexadecimal string)

Format: hexadecimal $(N)

Function: Converts the decimal number n into a hexadecimal string.

MKI$ (Convert Integer to String)

IKL$ (converting long integers into strings)

MKS$ (converts a single-precision number into a string)

DATE$/TIME$ (get the date/time of the system)

GOSUB/RETURN (call subroutine statement and return statement)

call subroutine

Format: gosub

Function: used to call the entry statement of subroutine to execute.

RETURN (subroutine return statement)

Format: Return [

Function: used to return from the subroutine after the subroutine is executed as the ending statement of the subroutine.

User defined function

Format 1: deffn [(parameter table)] =

Format 2: deffn [(parameter table)]

Statement block

FN< function name > =< emoticon >

End definition

Function: define the user's own function.

SUB (process definition)

Format: Subroutine Name [(Parameter Table)] [Static]

statement sequence

End joint

Function: define subprocesses

Function (process definition)

Format: Function Procedure Name [(Parameter Table)] [Static]

statement sequence

Procedure name = expression

End function

Function: define the function flow.

Declaration (procedure statement)

Format: declare [operation/sub] process name [(parameter table)]

Function: Explain the called procedure and check the passed independent variables.

DIM share/public share (define global variables)

Exam: DIM shared variable list/public shared variable list.

Function: define the variables in the variable name table as global variables.

Static (defining local variables)

Format: Static Variable Table

FUNCTION: a variable is defined as a local variable in a DEF FN function, function or SUB procedure.

Shared (* * * shared variables)

Format: shared variable [as type] [,variable [as type] …

Function: let the main program share variables with a process.

DIM (array definition)

Format: DIM[ shared] variable [(subscript)] [as type] [,variable [(subscript)] [as type]] …

Function: Interpret variables or arrays and allocate storage space.

REDIM (change the space allocated to the array)

Format: REDIM[ shared] variable (subscript) [AS type] [,variable (subscript [AS type] ...

Function: Change the space allocated to a dynamic array.

Option base (? )

Format: option base n

Function: Specifies the default lower bound of array subscripts.

Open (open or create a file)

Format 1: open file description [mode 1] is [#] file number [LEN= record length]

Format 2: Open mode 2, [#] file number, file description [,record length]

Description:

1. In the format 1, "mode 1" specifies the input/output of the file as follows:

Output specifies the sequential output mode.

Enter the specified sequential input mode.

APPEND specifies the sequential addition method.

RANDOM specifies the random access mode, which is also the default mode.

2. "Mode 2" in Format 2 refers to the following characters.

O Specifies the sequential output mode.

I specify the sequential input mode.

R Specifies random read/write mode.

Specifies the sequential addition method.

Close (end file read/write operation)

Format: Close [[#] DocNo. [,[#] DocNo.] ...]

Function: End the file read/write operation.

Free file

Format: free file

Function: Generate an unused minimum file number.

LinesofCommunication

Format: locked (n)

Function: Returns the current location of the specified file with file number n.

line of force

Format: LOF (North)

Function: Returns the file length.

Print #

Format: print # file number, [use format string; ] Expression [{,|; }]

Function: Write data into sequential file.

Write #

Format: Write # file number and expression table.

Function: Write data into sequential file.

Enter #

Format: Enter # file number and variable name.

Function: read data from sequential files and assign the read data to corresponding program variables.

Line input #

Format: LININPUT # file number, string variable

Function: read a whole line of data from a sequential file and assign it to a string variable after it.

eof

Format: EOF (document number)

Function: Check whether the file is read.

CLS

Format: CLS[0| 1|2]

Function: Clear part or all of the screen information.

Description: CLS 0 clears the entire screen, the system default.

CLS 1 If the graphic viewport has been set with the view statement, clear the viewport, otherwise clear the whole screen.

CLS 2 clears the text window, but the bottom line of the screen remains the same.

width

Format: 1 Width width

2. Width l Print width

Function: The function of the statement format 1 is to change the width of the screen display line, and the function of 2 is to change the width of the printer output line.

screen

Format: Screen [Mode] [,Color] [,Current Page] [,Visible Page]

Function: Set the screen display mode

PSET

Format: PSET[ step ](X, Y)[, color number]

Function: Draw a point with the specified color at the specified coordinate position.

Adjust in advance

Format: preset [step size ](X, Y)[, color number]

Function: Draw a point at the specified position (x, y) on the screen.

line

Format: line [[step] (x 1, y 1)]-[ step] (x2, y2) [,[color number], [,B[F]][, type symbol]

Function: Draw line segments or rectangular boxes on the screen.

circle

Format: circle [step ](X, y) radius [,color] [,start angle] [,end angle] [,aspect ratio]

Function: Draw an ellipse or an arc with a given radius with (x, y) as the center.

draw

Format: draw a string

Function: Draw a graph step by step according to the character string in the sentence.

colour

Format: 1 Color [foreground color] [,background color] [,border color]

2. Color [background color] [,color palette]

pigment

Format: Draw [Step ](X, Y)[, color number] [,border color]

Function: draw a closed figure with the specified color and border color.

visual angle

Format: view[[ screen] (x 1, y 1)-(x2, y2) [,[color number] [,border color]]]

Function: define the screen size of output graphics.

View print

Format: View Print [Top Line to Bottom Line]

Function: Define a text output area on the screen.

window

Format: window [[screen] (x 1, y 1)-(x2, y2)

Function: Defines the logical size of the current viewport.

get

Format: get [step] (x 1, y 1)-[step] (x2, y2), array name [(subscript)].

Function: Store the graphic images of the specified area on the screen in the "array".

let go

Format: PUT[STEP](X, y), array name [(subscript)] [,display mode]

Function: redisplay the graphic image stored in the GET statement in the designated area of the screen.

Beeping sound

Format: beep

Function: Make the computer speaker beep.

sound

Format: sound frequency, sound length

Function: make the sound from the speaker have a certain frequency delay.

play

Format: Play command string

Function: Music performance represented by a given string.

People upstairs don't seem to have studied qbasic, do they? Come on! !