print("i", "j", "i & j")
for i = 0,1 do
for j=0,1 do
print(i, j, i & j)
end
end
The above code works fine in Lua. It gives the following output.
i j i & j
0 0 0
0 1 0
1 0 0
1 1 1
I want to define another operator implies. It is conditional logical operator. The result p implies q is false only when p is true and q is false.
print("i", "j", "i implies j")
for i = 0,1 do
for j=0,1 do
print(i, j, i implies j)
end
end
I want the above code to work. It should output the following.
i j i implies j
0 0 1
0 1 1
1 0 0
1 1 1
So far I have succeeded in defining implies function but that doesn't seem to be of great use. Of course I can write implies(i,j) but I want operator similar to & or | that I can use. So basic question is to replicate definition of logical operator & or | from lua. Here is the code for implies function (not operator).
function implies(a,b)
if a then
return b
else
return True
end
end