Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between web static types and dynamic types

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "what is the difference between web static type and dynamic type". In daily operation, I believe that many people have doubts about the difference between web static type and dynamic type. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the question of "what is the difference between web static type and dynamic type?" Next, please follow the editor to study!

1. Static types VS dynamic types understand the difference between static and dynamic, and we need to start from the operation of variable assignment. In statically typed languages, the type of a variable must be declared first, that is, the type of the variable has been determined at the moment of creation, and then in use, you can only assign data of this specified type to the variable. If other irrelevant types of data are forcibly assigned to it, an error will be raised.

In static languages, once a variable is declared to be of type int, only data of type int can be assigned to it, otherwise an error will be raised, while dynamic types have no such restriction. The type of data you assign to a variable is what type it is.

The following languages are all dynamic types:

PHP

Ruby

Python

Common statically typed languages are:

C

C++

JAVA

C#

two。 The difference between strong type VS and weak type is reflected in the strict degree of type checking. Weakly typed languages are more relaxed in checking variable types and tolerate implicit type conversions. What is implicit type conversion? there are generally two forms:

Implicit conversion between related types

Implicit conversion of unrelated types

For example, if data of type int is added to data of type float, the final result is data of type float. Implicit type conversion occurs in this process. Int type data is first converted to float type, and then manipulated with another float, which is implicit conversion between related types. There is no error when an int type data is added to a string type data. The result is a string. The int type data is implicitly converted to a string, but they are originally two unrelated data types. This is the second kind of implicit conversion. In weakly typed languages, variables can be implicitly cast to irrelevant types, but not in strongly typed languages. According to this conceptual definition, PHP,Perl is a weakly typed language, while other programming languages that you see, such as java, C, Cellular languages, and Python, are strongly typed languages.

At this point, the study on "what is the difference between web static types and dynamic types" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report