Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# Simple lua expressions for kiddies
- -- not equal:
- a = 10
- if a == 10 then print('a equals 10!') end --> prints "a equals 10!"
- if a ~= 10 then print('a doesn\'t equals 10!') end
- if not (a == 10) then print('a doesn\'t equals 10!') end
- b = a == 10 --> b == true
- c = not (a == 10) --> c == false
- -- logical expressions:
- print(false and true) --> false
- print(false and true) --> false
- print(false or true) --> true
- print(true or false) --> true
- print(10 and 'yo') --> 'yo', 10 and 'yo' is "true"
- print(10 or 'yo') --> 10
- print(10 and 20 and 30 and 40) --> 40
- print(10 and 20 or 30 and 40) --> 20
- print(10 and false and 30 and 40) --> false
- print(10 and false or 30 and 40) --> 40
- print(not true) --> false
- print(not 'yo') --> false
- print(not not true) --> true
- print(not not 'yo') --> true
- print(10 and not false and 30 and 40) --> 40
- print(10 and not false or 30 and 40) --> true (not false -> true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement