Basics of Web front-end Learning 2

Source: Internet
Author: User

What we are sharing today is the data of variables and data types in Web front-end learning.

Data types actually refer to the classification of data.

The data types in the C # language have several common data types: 1, char (character type): Single character (Chinese characters, letters, numbers, punctuation marks), expressed in pairs of single quotation marks.

2, String (String type): Unlimited amount of text; double quotation marks in English

3, int (integer type): Used to represent an integer; direct writing

4, double (decimal type): The number used to represent the decimal point

Variable: A piece of space that stores data, and the data content of that memory area can change

When you use a variable in your code, you must first declare it and then assign the value. Declaration: Specify a memory space to hold data syntax: data type variable name;

Assignment: The memory space syntax for storing data into variables: variable name = data;

Use specification for variable naming: A, can only be composed of numbers, letters, underscores

B. Do not start with a number

C, the name cannot be the same as the keyword

D, variable names must not be the same in the same function variable

Soft requirements: A, to be able to look at the text to understand the meaning

B, first letter lowercase

C, in addition to the first word, the first letter of the other words capitalized

How to use variables: Merge declarations: Declaration of multiple variables of the same type, which can be done in a declaration statement

Declaring when initializing: initializing a variable while declaring it

Initialization: The process of assigning a value to a variable for the first time

Variable three elements: data type, variable name, variable value

Operation of the data

Numeric operations: Operational rules: Support operations: + 、-、 *,/,%, + + 、--

return type: Same as Operation type (note : int and int, return the result to int type; DOUBLR with double operation, return type double, double with int, return result to double)

String operations: Arithmetic rules: stitching (+)

return type: string

Basics of Web front-end Learning 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.