zoukankan      html  css  js  c++  java
  • #常用编程语言数据类型总结概要 #Python#Java#JavaScript#PHP

    常用编程语言数据类型总结概要

    Python3(6种)

    Python3 中有六个标准的数据类型:

    • Number(数字)
    • String(字符串)
    • List(列表)
    • Tuple(元组)
    • Set(集合)
    • Dictionary(字典)

    Python3 的六个标准数据类型中:

    • 不可变数据(3 个):Number(数字)、String(字符串)、Tuple(元组);

    • 可变数据(3 个):List(列表)、Dictionary(字典)、Set(集合)。

    Python3 支持 int、float、bool、complex(复数)

    在Python 3里,只有一种整数类型 int,表示为长整型,没有 python2 中的 Long。

    Java(8种)

    Java语言提供了八种基本类型。六种数字类型(四个整数型,两个浮点型),一种字符类型,还有一种布尔型。

    • 数字类型(6种):
      • byte : 8位
      • short:16位
      • int : 32位
      • long : 64位
      • float:单精度(32位)
      • double:双精度(64位)
    • 字符类型(1种):
      • char(16位Unicode)
    • 布尔型(1种):
      • boolean

    JavaScript(8种)

    Data and Structure types

    The latest ECMAScript standard defines nine types:

    // 7种基本数据类型

    • undefined : typeof instance === "undefined"

    • Boolean : typeof instance === "boolean"

    • Number : typeof instance === "number"

    • String : typeof instance === "string"

    • BigInt : typeof instance === "bigint"

    • Symbol : typeof instance === "symbol"

    • null : typeof instance === "object". Special primitive type having additional usage for it's value: if object is not inherited, then null is shown;

    // 2种引用数据类型

    • Object : typeof instance === "object". Special non-data but structural type for any constructed object instance also used as data structures: new Object, new Array, new Map, new Set, new WeakMap, new WeakSet, new Date and almost everything made with new keyword;

    • Function non data structure, though it also answers for typeof operator: typeof instance === "function". This answer is done as a special shorthand for Functions, though every Function constructor is derived from Object constructor.

      注意:数组本身是一种特殊的对象

      MDN

    PHP

    • String(字符串),
    • Integer(整型),
    • Float(浮点型),
    • Boolean(布尔型),
    • Array(数组),
    • Object(对象),
    • NULL(空值)。

    Java和Python都是强类型语言,PHP和JavaScript是弱类型语言。 从实践上去区分强弱类型语言标准是,强类型的语言,不会自动进行类型转换。例如将一个字符串和一个数字相加,强类型的语言就会报出错误,但是弱类型的语言不会。 例如,在JavaScirpt中,一个字符串和一个数字相加:会有以下“智能”的情况:

    let a = "你好";
    let b = 1;
    console.log("a+b=",a+b);
    
    console.log("-----------")
    
    let c = "123";
    let d = 1;
    console.log("c+d=",c+d)
    
    console.log("-----------")
    
    let e = "2";
    let f = "3";
    console.log("e*f=",e*f)
    
    $ node a.js
    a+b= 你好1
    -----------
    c+d= 1231
    -----------
    e*f= 6
    
  • 相关阅读:
    Springboot整合MongoDB的Docker开发,其它应用也类似
    Docker可视化工具Portainer
    Mac上使用Docker Desktop启动Kubernetes,踩坑后终于搞掂
    Docker入门——理解Docker的核心概念
    删库吧,Bug浪——我们在同一家摸鱼的公司
    一键下载网页所有图片,把美丽存下来
    序列推荐(transformer)
    [论文笔记] An introduction to ROC analysis
    【推荐算法工程师技术栈系列】分布式&数据库--tensorflow
    [论文翻译]Practical Diversified Recommendations on YouTube with Determinantal Point Processes
  • 原文地址:https://www.cnblogs.com/jaycethanks/p/12941034.html
Copyright © 2011-2022 走看看