fn read_line()
let result = string.builder()
let c = io.stdin:read()
while c != 10 and c != null
result:append(c:char())
c = io.stdin:read()
end
return str(result)
end
What is considered better practice?
Case 1:
if n == 0:
doThis()
elif n < 0:
doThat()
elif n > 0:
doSomethingElse()
Case 2:
if n == 0:
doThis()
elif n < 0:
doThat()
else:
doSomethingElse()
The first case is more explicit and (arguably) clearer.
The second case doesn't han...
i spent 2 hours messing with my metatable lookup functions to fix an error only to realize i forgot my own operator precedence and an extra set of parens was all i needed