In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is to share with you what are the basic knowledge points of VBS. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
VBScript (Microsoft Visual Basic Script Editon)., Microsoft Visual BASIC script version. As it literally reveals, VBS (short for VBScript) is a scripting language based on Visual Basic. Microsoft Visual Basic is a visual programming tool produced by Microsoft, and its syntax is based on Basic. Scripting language, which is not compiled into binary files, is directly interpreted and executed by the host (host). To put it simply, the program you write does not need to be compiled into .exe, but directly sends the .vbs source program to the user, and the user can execute it.
I know that the rookie is most concerned about what tools to develop VBS programs, the answer is: notepad (Notepad), I am not kidding, in fact, any kind of text editor can be used to develop VBS development, but notepad is brought by the system, it is easier to find it. Nevertheless, I still suggest you to download a professional text editor, because these tools can provide "syntax highlighting" and other functions, more convenient for development, which you like, I prefer Edit Plus ScriptCryptor is also good OK, let's first write a VBScript program to warm up.
REM type and echo your name 'use InputBox and Msgbox functions' (the above and this line do not have to be written into the source code, the following is the running code) Dim name,msg msg= "Please enter your name:" name=Inputbox (msg) Msgbox name
Enter the above program list into notepad and save it as a file with a .vbs extension (if there is no ".* *" on the file name, open the Control Panel-folder options-View-unhide the extension of the known file type). Then double-click to observe the results of the run.
Note: in order to make you learn better, it is recommended that you enter the program list and try not to copy-> paste.
Let me explain this program. The first line and the second line begin with a "REM" statement and a "'", respectively. These two things have the same function, indicating that the following text is a comment, that is, nothing is done after the symbol, but only to illustrate the function of the program, copyright information, and so on. The comment line is one of the most important parts of the program, and although it is not necessary, it is good for others to read the source code and analyze the source code themselves. A good habit is to add clear and concise comments where necessary.
Dim is used to declare a variable, in VBS, the variable type is not so important, that is to say, VBS will help you automatically identify the variable type, and the variable does not have to be declared before use, the program will dynamically allocate variable space. In VBS, you don't have to consider whether name stores an integer or a decimal (the scientific name is "floating point"), or whether it is a string (a string of characters, such as "Hello World"). VBS will automatically fix it for you. So the third line of statement can be deleted, the effect will not change, but I am strongly opposed to doing so, the basic principle of a variable is: declare first, then use. Variable names start with letters, can use underscores, numbers, but cannot use words already defined by vbs, such as dim, or pure numbers.
The next line is called assignment, and "=" is the assignment symbol, not the equal sign in mathematics, even though it looks the same. This is an orthodox understanding, and there is nothing wrong with it if you understand it. To the left of the assignment sign is a variable, and on the right is the value to be assigned to the variable. After the assignment, the variable msg is equivalent to the string "Please enter your name:" in the program, but when the msg is assigned again, the original value will disappear. Not only the string, but any other variable is assigned this way, for example: axi2, bounded 12.222, and so on.
Further, Inputbox and Msgbox are built-in VBS functions, a function is equivalent to a "black box", with input (parameters) and output (return) values, you do not need to understand how the function works, as long as you know what this function can do, we can also define our own functions, but we will have to wait until later. Now we just need to understand that a function can have a return value or no arguments. For example, Inputbox is a function with a return value. We use the variable to the left of the assignment sign to "catch" the return value of InputBox-- that's what you type. In the parentheses to the right of inputbox is the parameter list. Each parameter is separated by ",". Each parameter has different functions. For example, the first parameter is displayed in the prompt, we pass the variable msg as the first parameter to the Inputbox function, and msg= "Please enter your name:" So we will see in the prompt bar of the dialog box, "Please enter your name:" the second parameter is the title of the dialog box, and we pass it to the function with a direct quantity (scientific name "constant", here is "string constant"). Of course, you can also pass variables. Inputbox also has many parameters, such as you add a "," after the "name" and then enter a random string of characters (a string, a string wrapped in double quotes is called a string) and run it to see the result. You will find that the text box used for input has a default value, which is what the third parameter does.
The Msgbox function is a function used for output, and there is no special output function in VBS (printf in print,C in BASIC), so we can only use a dialog box to observe the output result. There is only one necessary parameter for Msgbox, that is, the content to be output. In this case, we do not need to pay attention to the return value of msgbox. We'll talk about Msgbox and Inputbox in the future. Today is just a warm-up, that's all.
Main points:
1) comment lines (starting with REM or') don't work in the program, but make it easier for others to read your program.
2) A variable is like a box, or a code name, that represents what you want to represent. Variable assignment uses "="
3) the character wrapped in "" is called "string".
4) the function is like a "black box" with parameters and return values. You can catch the return values with the variable to the left of "=".
5) the Inputbox function pops up an input dialog box, and Msgbox is used for output
Assignment:
1) the third parameter of the test Inputbox
2) write a program to output your age
3) write a program to input 3 times, enter your name and your parents' name respectively (ask for prompt), and output 3 times.
The second article (a total of six)
Today we will talk about all kinds of "quantity" and basic operations.
Let's start with constants, which is relatively simple.
What is a constant? a constant is a quantity whose value is immutable.
There are two kinds of constants: the first, natural constants. This is called because they are constants themselves. How do you change the value of 21? He'll always be 21. He can't be 46.
If you use "21 percent 46" in the program, such a statement will cause an error. Similarly, a string is a constant (remember the string? Is a string of characters wrapped between "Hello World". "Hello World" is an example. If you use a statement like "Hello World" = "Bye", it will also cause an error. Can you give more examples of natural constants?
The second is our own defined constants, which also use codes, and they are also assigned, but unlike variables, they are assigned at the time of definition and cannot be changed in the future. If you try to change it, it will cause an error. To define a constant, we use the keyword "const" (which means that the system defines a word with a special function and cannot be used as a variable name or constant name)
The format is const constant name = constant value.
For example:
Const PI=3.1415962
Const NAME= ""
So we define two constants, PI and NAME. Generally speaking, constant names are all capitalized, but you don't have to, whatever you like. It is a good habit to define some values that do not need to be changed in the program as constants, which can prevent unnecessary accidents. In addition, using custom constants can also reduce your workload. For example:
Msgbox "Hello World"
Msgbox "Hello World"
Msgbox "Hello World"
Msgbox "Hello World"
Msgbox "Hello World"
This program outputs Hello World five times. If you want to change the output to Bye-Bye, you must modify the whole program. Of course, you can manually modify it 5 times, but what if you want to output 1000 times? Constants can solve this problem for us:
Const hw= "Hello World"
Msgbox hw
Msgbox hw
Msgbox hw
Msgbox hw
Msgbox hw
So when you want to modify the output, just change the value of hw.
Okay, now let's look at the first important cornerstone of programming: variables. I think the best way to explain a variable is a "box". A variable is like a box in which only one thing can be contained. When you want to put something else in it, you have to take out the original thing. The "box" has a name, and when you use variables in the program, the system will open the box and take out the contents and let them participate in the processing, not the box. Some languages are very dependent on what is in the box in order to find the right box (such as C language), but VBS provides me with a "magic box" that can stretch automatically. We don't have to care about what is in it. VBS will automatically resize the box. For example:
Dim a1,a2,a3
A1: 14
A2. 12. 23
A3 = "Hello"
It doesn't have to be as troublesome as C: or the formal declaration of VB (VB can declare or not):
Int A1; Dim A1 as integer float a2; Dim a2 as Double char* a3; Dim a3 as string a1 14; A1 14 a2 12.23; a2 12.23 a3 = "Hello"; A3 = "Hello"
Um... It goes too far.
What's the use of variables? Wow, that's of great use. At its simplest, you can't determine the value of the program's runtime variables, such as the program we programmed to enter names in the previous lesson, and you're not sure what InputBox returns (remember the return value of Inputbox? That's what you typed, so you can't deal with all kinds of situations, but we use the name "box" to put the user's name together. When we use it, we just need to know the name of the name box, and the system will open it and take out the contents. For another example, let's write a program to calculate the area of a rectangle. For example, this program should be sent to primary school students to use:
Dim a dagger bjorn s aura 15 baud 12 s=a*b msgbox s
In this way, we can find the area of a rectangle with a length of 15 and a width of 12, isn't it very simple? Of course, the program can also be written as follows:
Dim s 15012 msgbox s
It seems that the program is much shorter and saves memory, but neither is encouraged. Why? Please look below.
Now, our program has to look like something, whose program needs others to modify the source code before it can be used?
So, we have to accept user input, remember? InputBox function.
The modified procedure is as follows:
Dim a BBJ s a=inputbox ("Please enter the length of the rectangle:") b=inputbox ("Please enter the width of the rectangle:") s=a*b msgbox s
Ok, with such a modification, no matter what data the user enters, we can calculate the area of the rectangle. Can you change it if you use swatches 1512? Of course not.
I think you have found that mathematical calculations in vbs are no different from real arithmetic. +, -, *, /, [], {} are all used in the same way, such as:
Dim ans ans=12+32/4+ [(23-10) * 2] msgbox ans
The four rules of operation also work in programming, where you can regain the fun you had in elementary school (do you hate math? Then don't learn computer.
An interesting operator in programming is "mod". This operator is called the "remainder operator", which is to get the remainder of a division, such as
Dim a
Axiom 16 mod 5
Do you know what an equals? Bingo! That's right, it's 1. Because 16 / 5 = 3. 1, the result of the mod calculation is 1. 5.
Another operator is "^" (the small arrow on the keyboard "6"), which means "power" (or "square"), such as:
Dim a ^ 2 c = a ^ 3 msgbox b msgbox c
Then b=a*a=4, c=a*a*a=8
All right, let's not talk too much at once. That's all for this time. Let's sum it up now.
Main points:
1) constants are divided into natural constants and custom constants. The value of constants cannot be modified.
2) variables are like boxes. We don't care what's in the box, but we must know the name of the box.
3) there is no difference between the four operations in programming.
4) MOD is a remainder operation.
Assignment:
1) write a program to calculate the area of the circle, the radius given by the user (using Inputbox) PI value of 3.14159
2) write a program to get the remainder of 20 / 3
The third (a total of six)
First of all, let me solve some questions from the last course.
First, the problem of the remainder, 16 / 5 = 3. 1, because I changed the front part and forgot to change the back part. I'm sorry.
Second, please take a look at the program list:
(1)
Dim a dint bjorc a=inputbox ("an is:", "input radius") b=Inputbox ("b is:", "input radius") c=a*2+b*2 msgbox c
This input 1, 2 is 6.
(2)
Dim a _ msgbox _ c _ a=inputbox ("an is:", "input radius") b=Inputbox ("b is:", "input radius") c = (aquib) * 2 radius c
When you enter 1 or 2, it's 24.
Why is it different? Mathematically, c = (aqb) * 2 is equivalent to c=a*2+b*2, as well as in VBS. The problem is "+". In VBS, + means not only a plus sign but also a concatenation of two strings, such as "Hello" + "World" = "HelloWorld", have you understood? Do you remember the return value of the InoutBox function? It's a string! We can see the problem. In programming, "1" is not equal to () 1, "1" is a character, and 1 is a number, so "1" b is a string variable, "1" + "2" = "12". It's like asking our partners jokingly when we're kids. Similarly, we always smile and say "wrong, it should be 11." But why can a be * 2 without making an error? At this time, a manifestation of VBS's intelligence is that if the content of the string is a number and a mathematical operation is performed on it, the string is forced to be converted into a number to participate in the operation. If the string represents a number, but does not participate in the mathematical operation, but participates in the string operation (merge), it is treated as a string, so you see a+b=12. At this time, the result (12) of aqumb is a string. When it is to be multiplied by 2, it is forced to convert to the number 12, so I get the result 24.
How to modify this program? We need to use another built-in function: int, the function of the int function is to convert the input value into an integer value, which we modify as follows:
C = (int (a) + int (b)) * 2
This means passing an as an argument to the int function, and the int function will return that integer (your input value), and then let the return value participate in the operation, thus getting the correct answer. So, if you use the inputbox function in the future, it's best to process it with an int statement: for example, c=int (c)'c is your own variable.
In addition, there is another function: CDbl. Use this if you want to convert characters to numbers but don't round them:
Dim a d=CDbl c msgbox e a=inputbox ("an is:", "input radius") b=Inputbox ("b is:", "input radius") c=CDbl (a) d=CDbl (b) e = (Centrd) * 2 radius e
If you enter 1.2, 1.3 will output 5.
The above examples can also be summarized as follows:
Dim aforme b a=CDbl (inputbox ("an is:", "input radius")) b=CDbl (Inputbox ("b is:", "input radius")) Msgbox (axib) * 2
If you enter 1.2, 1.3 will still get 5. However, this is more suitable for friends who have studied VBS for a period of time.
Do you think this course is a little boring? Oh, this is true for variables and operators, but it would be nice to practice a lot. This time, let's write something really fun: flow control statements. This part is the real programming at the beginning.
First of all, the judgment structure is introduced.
Before that, let's introduce a simple variable type: Boolean, which has only two possible values: True,Flase, true or false. This variable is useful in some cases (such as "switch"). We define a Boolean variable in the same way as other variables, with the same assignment, for example:
Dim a,b
A=true
B=false
Note that true is different from "true" (with double quotes). "true" is a string and true is a Boolean value.
Coming back to the if statement, let's first take a look at the simplified version of the if statement: the if judgment then statement body. Let's look at an example:
Dim a,b
Axi12
Bread13
If b > a then msgbox "B is greater than A"
Let's just look at the last line. The expression a > b has a return value, which is Boolean. Because there are only two possibilities for this formula: B is greater than an and b is not greater than a, there are only two possibilities for this formula, that is, true or false. If statement to determine whether the return value of this expression is true or false, if it is true (true), then execute the statement after then, if it is false, then do not execute, you change the value of a to 14 to see if the dialog box will pop up?
What do we do when we want to execute a multi-line statement after the judgment? we need a sentence block to solve it, which can be called a block if here.
Dim a,b
Axi12
Bread13
If A100 then msgbox "right" else msgbox "wrong" end if
You see an extra else. The function of else is to execute when the expression to be judged is false. In this way, the program can handle two different situations. Don't forget to end with end if.
Hey, hey, I'm a pervert. Now I want you to deal with three situations, 100. and write it in an if structure. what do you do? I'll give you the answer:
Dim an a=inputbox ("Please enter a number greater than 100") a=int (a) 'inputbox returns a string, we turn it into an integer if a > 100 then msgbox "correct" else if averse 100 then msgbox "boss, are you kidding me?" else msgbox "wrong" end if end if
Enter 100 this time. What is it? Elseif statements can appear multiple times in the if structure to flexibly judge different situations (if you want to judge too much, please use the "select structure" and talk about it later), and execute the statements in the else when all the elseif has been processed and there is no match. Another example:
Dim b=Inputbox bforce c a=inputbox ("an is:", "input radius") b=Inputbox ("b is:", "input radius") d=Inputbox ("answer:", "enter answer") c=a*2+b*2 'there is no question here, it will automatically convert if Dacron then msgbox "Hello clever" else msgbox "Hello pig head own question not yet!" end if
Haha, no matter how correct your answer is, you are a pig. I am not fooling you, or the return type of inputbox at the beginning of the article is playing you. D is the return value of inputbox, he is a string, and c is the result of an integer calculation, he is an integer. A string is not equal to an integer in any case, although they are literally the same: "8" (not equal to the sign) 8, so the critical value of if is always false, always executing the else part of the statement. We can modify it like this.
Dim a d=int bforce c a=inputbox ("an is:", "input radius") b=Inputbox ("b is:", "input radius") d=Inputbox ("answer:", "enter answer") d=int (d) 'here we take the value of d and turn it into an integer. Put it back in the "d" box, c=a*2+b*2 if dancc then msgbox, "you're so smart," else msgbox, "Hello, pig, you don't know your own problem yet!" end if
This is a success. This is also a nuisance of the Inputbox function, there is no way, vbs has no other good input.
Speaking of if, we have to talk about logical operators. Today, we introduce two kinds, "and" and "or". After learning the if statement, I will give you an example that you will understand at a glance.
Dim an and b a=inputbox ("enter a number > 10") b=inputbox ("enter another number > 10") a=int (a) b=int (b) if a > 10 and b > 10 then msgbox "correct" else msgbox "wrong" end if
This program allows you to enter two values, both of which must be greater than 10, and output errors as long as one is not greater than
Dim an or b a=inputbox ("enter a number > 10") b=inputbox ("enter another number > 10") a=int (a) b=int (b) if a > 10 or b > 10 then msgbox "correct" else msgbox "wrong" end if
This program allows you to enter two values, as long as one is greater than 10, it will return success. In fact, and and or are easy to understand. I read the sentence "if a > 10 or b > 10 then" in Chinese: "if an is greater than 10 or b is greater than 10, then." Is it easy to understand?
OK, let's take a look at a new structure. After learning this, today's class is over. It's already midnight. I'm exhausted.
When your program has to deal with many different judgment situations, elseif..then will make the program look messy, so there is a select case structure to deal with this situation, and the syntax structure of select case is very simple:
Select case variable name
Case value
Statement
Case value
Statement
Case else
Statement
End select
Let us give an example to illustrate very simply:
Dim an a=inputbox ("enter a value of 1murmur3") a=int (a) 'handles the problem that inputbox returns a string select case a case 1 msgbox "one" case 2 msgbox "two" case 3 msgbox "three" case else msgbox "input error" end select "
This example converts the three Arabic numerals 1Jing 2jue 3 into Chinese uppercase numbers. The program is written in the form of if...elseif as follows
Dim an a=inputbox ("Please enter the value of 1 Mustang 3") a=int (a) if ajar 1 then msgbox "one" elseif aquifer 2 then msgbox "II" elseif aquifer 3 then msgbox "3" else msgbox "input error" end if
What do you say, please? select is all right.
OK, that's all for today. To sum up:
Main points:
1) inputbox returns a string, not a number, which must be converted to a number in the form of a=int (a)
2) there are only two values for bool variables: true,false
2. 5) if the expressions on both sides of and are true, it returns true. If one of the expressions on both sides of the or is true, it returns true.
3) format of if statement
4) format of select...case
Assignment:
1) use 3 Bools to store whether your 3 siblings are male (hint: sister1male=false)
2) given a number that is greater than 10 and less than 20, the output is "correct", otherwise the output "error"
3) input 12, or 15, output "correct", otherwise output "error"
4) convert all positive integers within 5 into larger numbers in China
5) randomly design a program and apply today's knowledge.
The fourth article (a total of six)
Hello, everyone. Write Chapter 4: loop structure today.
Let's first look at a problem: shopping malls carry out daily settlement, asking to add up today's turnover and enter a number at a time. This problem is actually very simple, but it is very troublesome for us to complete this problem according to the knowledge we have learned now. Let's analyze it. First of all, we need to know the number of transactions in order to control the number of inputs, but this design is very inefficient and the program has to be redesigned every day. Assuming that five transactions have been made today, here is the source program:
The form of dim sum sum=0 'initialization variable sum=sum+ int (inputbox ("Please enter transaction volume")' sum=sum+x "is to take out its own value, perform an operation, and then put it back into itself. This method is very useful. Here, function nesting is used to pass the return value of inputbox directly to the int function, which is converted into an integer. Same as sum=sum + int (inputbox ("please enter transaction volume") sum=sum + int (inputbox ("please enter transaction volume") sum=sum + int (inputbox ("please enter transaction volume") sum=sum + int (inputbox ("please enter transaction volume")) msgbox sum
See, I designed the program by copying the calculation process five times. This kind of program can make do in places such as car exchanges where there are few transactions. If you put it in the supermarket, don't you have to copy and paste it thousands of times? What we are talking about today can overcome this shortcoming. First of all, let's talk about the following Do...Loop statement.
The structure of do...loop looks very simple: do...loop, that's all, this structure constantly executes the statements between do and loop (scientific name: loop body) and never stops. For example:
Do
Msgbox "this message will be repeated over and over again. To stop the program, please use Task Manager (Ctrl+Alt+Del) to abort the wscript process."
Loop
Run this program, when you click one dialog box will come out another, you will never finish, there will always be the next one. Who would run such a program? Unless you're messing with someone (as I've done before), there's another statement in the do..loop structure: exit do, which terminates the loop and jumps to the statement after loop to continue execution. For example:
Dim a 'Note: the constant does not need to be declared in dim, otherwise it will cause an error const pass= "123456". This is a string. Please wrap it in "". Set the password to constant and cannot change do a=inputbox ("Please enter password") if a=pass then msgbox "password check success" exit do end if loop
This program will keep asking you for your password until you enter the correct password. (if can be nested in another if or in the loop body, so be sure to use indentation to distinguish the various parts of the program. This program is very classic, and early programs did it. But we are Hacker, so we know the security of the system, this unlimited authentication procedure is easy to be cracked, we have to limit the number of authentication. The modification procedure is as follows
Dim a dint CTR ctr=0 'set counter const pass= "pas123_" the one above is a weak password, this time a bit stronger do a=inputbox ("please enter the password") if a=pass then msgbox "authentication success" exit do else if ctr=3 then msgbox "has reached the authentication limit, authentication program closes" exit do else ctr=ctr+1 Note: this is an assignment sentence. To read from right to left, that is, add 1 to ctr every time an error occurs, and then put it back into ctr to make this constant add 1 msgbox. "Authentication error, please check the password" end if end if loop.
Try to run this program. When you make 3 mistakes, you will stop asking for the password again and close the program. The procedure used to limit the number of times of telnet certification is more or less the same. Pay attention to the nested if statements, please read this program carefully, it may be difficult to understand, please try to design a similar program yourself.
In fact, in order to add verification function to do...loop, it is not necessary to use if, we can directly use do. Let me introduce the while keyword. While can be placed after do or loop, followed by an expression that runs the loop body when the value of the expression is true (the expression holds). Let's take a look at the revised program. "
Dim a ctr ctr=0 const pass= "pas123_" do while ctrt2 then co=t1 'returns the result elseif T2 > T1 then co=t2 end if end function through the method of "function name = expression"
Here we use a new keyword: funciton, which indicates the beginning of a new function in the format:
The name of the function function (argument 1, argument 2... Parameter n) 'list can be empty, but parentheses cannot be omitted, and parameters are separated by ","
...
Exit function 'end function, not required
...
End function
A function is a module that runs only when you call it, that is, when you write a function and then don't call it in the program, the function will never run. Generally speaking, we write programs according to:
Main program
.
.
.
Function 1
.
.
Function 2
.
.
Explain in detail: the most important things in the function are parameters and return values. Parameters are defined in () after the function name, split with ",", and we also use "," when using parameters. Speaking of which, I think of one thing. Yesterday, a friend sent me a message and asked me:
Msgbox name1,name2,name3
What's wrong with this? Why not show three variables at the same time? This is because you use the symbol ",", which means that the three quantities you enter are passed to the msgbox) function as three different arguments. The msgbox () function only displays the first parameter, and the second parameter appears in the title bar. So you should concatenate three string variables with "&" or "+" and pass them to the msgbox () function as the first argument. Programmers often talk about slang like "formal parameter" and "actual parameter" when talking about parameters. Let me explain. "formal parameter" is the abbreviation of "formal parameter", and "actual parameter" is the abbreviation of "actual parameter". The actual parameter refers to the amount that you pass to the function when you call the function, which can make variables or constants (direct quantities). For example, 12jue 24 in co (12prime24) is the actual parameter. Formal parameters are variables that you define when defining a function. These variables are used to "catch" the quantity passed, such as function co.
In VBScript, parameter passing is a kind of passing value, not address (it doesn't matter if you don't understand, you'll understand when you learn the pointer in C language), so our parameter passing is actually a variable assignment, for example, we call co (a1Mague a2). In fact, the program will perform one step: t1correca1 and t2correca2. Also for the reason of passing value and address, VBScript can only return one value. Let's take a look at what "return" means. When one procedure calls another procedure (for example, the main program calls a function), control goes to the called procedure. When the procedure is finished, it will go back to the place where it was called. This is called "return" and can be returned with a value called "return value" (this is a "popular" understanding). Vbs inherits the tradition of basic and returns with the method of "function name = return value". This "return value" refers to an expression (in programming, everything is an expression, such as variable a, constant 0, "Hello", centering 1, 2, etc.). such as
If one function is ht, the return method is: ht= the value you want to return. Note: after returning, the following statements will no longer be executed.
I don't have to talk about calling a function: variable = function name (parameter)
Sometimes we don't need to return a value, so we can use a structure called a subroutine. The difference between subroutines or procedures and functions
It is: 1) No return value, 2) defined using the sub keyword, 3) called through Call. For example:
Dim yname yname=inputbox ("Please enter your name:") call who (yname) sub who (cname) msgbox "Hello" & cname msgbox "Thank you for reading my course" msgbox "this is the last lesson in the basic part" end sub "
You must have seen it. It's very simple. Exiting a procedure is the same as exiting a function: exit sub (function: exit function).
It should be noted that the subroutine (process) is a relatively special structure. Languages such as C do not have this concept. Everything in C language is a function and there is no function that returns a value.
In C language, all you have to do is to use the void modifier definition.
There is nothing to talk about today. The basics are over. Now that you have basic programming concepts (process-oriented structured programming), you can choose to learn another language (such as C or Pascal). The basics will help. If you want to continue to learn vbs or learn more about programming through it, you can continue to learn from me during the transition, but the update time may be slow because my holiday is over. Please forgive me. The preliminary plan is as follows:
Advanced chapters:
In-depth discussion of variables
┣ variable type
Valid range of ┣ variables
In-depth discussion of ┣ array
┣ dynamic array
In-depth discussion of ┣ function
┣ array as a function parameter
Multiple return values for ┣
┣ string operation
┣ other
Basic knowledge of ┣ object-oriented programming (OOP)
┣ file operation
┣ FSO object
Other relevant parts of ┣
┣ VBS and Web pages
Embed VBS in ┣ HTML
┗ VBS and forms (design your program interface wow!)
Actual combat chapter
┣ virus programming
┗ Socket programming (TCP/UDP)
This is only a general idea. I think there will be a change. You will read it then. Please practice today's content. The assignment is to review the previous courses. For those who want to leave this course to further study: wish you smooth sailing on the road of learning programming again.
Edit the common vbScript operators and functions in this paragraph
Basic operation
+ numeric addition and string concatenation
-Digital subtraction
* Digital multiplication
/ digital division
Mod calculates remainder
\ Quotient
& string concatenation
To the ^ power
= equal
Not equal
> = greater than or equal to
> greater than
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.