zoukankan      html  css  js  c++  java
  • 通过lua自带例子学习lua 02

    -- Example 6 -- Case Sensitive.

    -- Lua is case sensitive so all variable names & keywords
    -- must be in correct case.
    
    ab=1
    Ab=2
    AB=3
    print(ab,Ab,AB)
    
     
    
    -------- Output ------
    
    1 2 3

    -- Example 7 -- Keywords.

    -- Lua reserved words are: and, break, do, else, elseif,
    -- end, false, for, function, if, in, local, nil, not, or,
    -- repeat, return, then, true, until, while.
    
    -- Keywords cannot be used for variable names,
    -- 'and' is a keyword, but AND is not, so it is a legal variable name.
    AND=3
    print(AND)
    
     
    
    -------- Output ------
    
    3

    -- Example 8 -- Strings.

    a="single 'quoted' string and double \"quoted\" string inside"
    b='single \'quoted\' string and double "quoted" string inside'
    c= [[ multiple line
    with 'single'
    and "double" quoted strings inside.]]
    
    print(a)
    print(b)
    print(c)
    
    
    -------- Output ------
    
    single 'quoted' string and double "quoted" string inside
    single 'quoted' string and double "quoted" string inside
    multiple line
    with 'single'
    and "double" quoted strings inside.

    -- Example 9 -- Assignments.

    -- Multiple assignments are valid.
    -- var1,var2=var3,var4
    
    a,b,c,d,e = 1, 2, "three", "four", 5
    
    print(a,b,c,d,e)
    
     
    
    -------- Output ------
    
    1 2 three four 5

    -- Example 10 -- More Assignments.

    -- Multiple assignments allows one line to swap two variables.
    
    print(a,b)
    a,b=b,a
    print(a,b)
    
     
    
    -------- Output ------
    
    1 2
    2 1
  • 相关阅读:
    python 测试日志的简单写法
    selenium web端滑动页面查找元素
    selenium之内嵌网页iframe切换
    selenium多窗口切换,及其关闭
    selenium 双击操作右击操作鼠标悬停
    selenium web元素定位合集
    三大浏览器的驱动地址
    app 怎么区分是原生
    django 处理图片上传
    django时区问题
  • 原文地址:https://www.cnblogs.com/sdlypyzq/p/3002438.html
Copyright © 2011-2022 走看看