Đang chuẩn bị liên kết để tải về tài liệu:
Variables C# interfaces

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Incrementing and Decrementing Variables If you wanted to add 1 to a variable, you could use the + operator: count = count + 1; However, it is unlikely that an experienced programmer would write code like this. | Incrementing and Decrementing Variables If you wanted to add 1 to a variable you could use the operator count count 1 However it is unlikely that an experienced programmer would write code like this. Adding 1 to a variable is so common that in C you can do it with the operator. To increment the variable count by 1 write the following statement count Similarly subtracting 1 from a variable is so common that in C you can do it with the operator. To decrement the variable count by one write this statement count-- NOTE The and operators are unary operators meaning that they take only a single operand. Theyshare the same precedence and left associativity as the unary operator which is discussed in Chapter 4 Using Decision Statements. The following table shows you how to use these two operators. Don t write this Write this variable variable 1 variable variable variable - 1 variable-- Prefix and Postfix The increment and decrement operators are unusual in that you can place them either before or after the variable. Using the operator symbol before the variable is called the prefix form of the operator and using the operator symbol after the variable is called the postfix form. Here are examples count postfix increment count prefix increment count-- postfix decrement --count prefix decrement Whether you use the prefix or postfix form of the or operator makes no difference to the variable being incremented or decremented. For example if you write count the value of count increases by 1 and if you write count the value of count also increases by 1. Knowing this you re probably wondering why there are two ways to write the same thing. To understand the answer you must remember that and are operators and that all operators produce a value. The value produced by count is the value of count before the increment takes place whereas the value produced by count is the value of count after the increment takes place. Here is an example int x x 42 Console.WriteLine x x is now 43 42 .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.