summaryrefslogtreecommitdiffhomepage
path: root/lua.html.markdown
diff options
context:
space:
mode:
authorAlburIvan <albur.ivan@outlook.com>2018-10-28 03:00:26 -0400
committerAlburIvan <albur.ivan@outlook.com>2018-10-28 03:00:26 -0400
commitdf0a0fa2a6ea1b818e3c6aaa139f77fde41f0256 (patch)
treec912eebef5bf5bfd45d4c2b6c91f355157041de8 /lua.html.markdown
parent73b8cd9a39ab9b63dd5e2c1c123c363fd014753a (diff)
parent27fa7c50ce23def736a69711f827918acc726e37 (diff)
Merge branch 'master' of github.com:adambard/learnxinyminutes-docs into matlab-es
Diffstat (limited to 'lua.html.markdown')
-rw-r--r--lua.html.markdown5
1 files changed, 5 insertions, 0 deletions
diff --git a/lua.html.markdown b/lua.html.markdown
index 1e2d4366..32174a81 100644
--- a/lua.html.markdown
+++ b/lua.html.markdown
@@ -62,6 +62,11 @@ if not aBoolValue then print('twas false') end
-- in C/js:
ans = aBoolValue and 'yes' or 'no' --> 'no'
+-- BEWARE: this only acts as a ternary if the value returned when the condition
+-- evaluates to true is not `false` or Nil
+iAmNotFalse = (not aBoolValue) and false or true --> true
+iAmAlsoNotFalse = (not aBoolValue) and true or false --> true
+
karlSum = 0
for i = 1, 100 do -- The range includes both ends.
karlSum = karlSum + i