zoukankan      html  css  js  c++  java
  • 【lua学习笔记】--- 数据类型

    print("hello world!")
    --【注释方法】
    -- 单行注释 对应C# //
    --[[
    多行注释

    /*
    对应C#
    */
    ]]--


    -- 【数据类型】
    --1 nil 空值 对应C# null
    print(nil)
    a = 5
    print(a)
    print(b)


    --2 boolean 布尔类型 对应C# true false
    --or and not 关系运算符 对应C#C# || && !
    print(type(true))
    print(false)
    print(true or false)
    print(true and true)
    print(not true)
    print(type)


    --3 number 数字类型 对应C# int float double 等等
    a = 5.090901
    print(a)
    print(a)

    --4 string 类型
    print(type("1234"))
    print(string)
    str1 = "123"
    str2 = '456'
    print(str1)
    print(str2)

    -- function 函数
    print(type(type))

    function function_name( num1,num2,num3,num4) --任意个数的参数
    a = num1 / 2
    b = num2 / 4
    c = num3 / 2
    d = num4 / 4
    print(num1)
    print(num2)
    return a,b,c,d --任意个数的返回值
    end

    q,w,e,r = function_name(10,3,5,11)
    print(q)
    print(w)
    print(e)
    print(r)


    -- table 表类型

  • 相关阅读:
    五种I/O模型
    Python socket服务
    Python 协程
    python openpyxl 简单使用
    python 文件夹压缩
    Python 多进程
    MySQL 自定义函数
    python 队列
    python 多线程、线程锁、事件
    python paramiko模块:远程连接服务器
  • 原文地址:https://www.cnblogs.com/nanwei/p/7074427.html
Copyright © 2011-2022 走看看