zoukankan      html  css  js  c++  java
  • lua的运算符

    1、赋值运算符

    --赋值
    str="helllo".."world"
    print(str)
    a,b=10,20
    print(a,b)
    c,d,e=1,2
    print(c,d,e)
    x,y=4,5,6
    print(x,y)

    2.算术运算符

    --算术运算
    a,b=10,20
    --加法
    c=a+b
    print(a.."+"..b.."="..c)
    --减法
    c=a-b
    print(a.."-"..b.."="..c)
    --乘法
    c=a*b
    print(a.."*"..b.."="..c)
    --除法
    c=a/b
    print(a.."/"..b.."="..c)
    --求余
    c=a%b
    print(a.."%"..b.."="..c)
    --乘方
    c=a^2
    print(a.."^2".."="..c)

    3.关系运算符

    a,b=10,20
    print(a>b)
    print(a<b)
    print(a==b)
    print(a~=b)
    4.逻辑运算符
    --逻辑运算符
    print(true and false)
    print(true or false)
    print(not true) 

    4.逻辑运算符

    --逻辑运算符

    print(true and false)
    
    print(true or false)
    
    print(not true)

    5.其它运算符

    --其它运算符
    str="helloworld"
    print(#str)

    ---恢复内容结束---

  • 相关阅读:
    AOP概述
    AOP-动态代理
    IOC容器和Bean的配置
    Spring框架概述
    异常
    Optional 类
    Stream API
    方法引用(Method References)
    函数式(Functional)接口
    stm8笔记1-搭建工程+孤独的小灯闪烁
  • 原文地址:https://www.cnblogs.com/alexzhang92/p/10890450.html
Copyright © 2011-2022 走看看