local highest1 = {}
local votedConcorrents = {"apple","apple","orange","cheese"}
local alreadyMentionedConcorrents = {"name"}
for i,n1 in pairs(votedConcorrents) do
for l,n2 in pairs(alreadyMentionedConcorrents) do
print(i,n1)
if n1 == n2 then
print("same")
elseif not n1 == n2 then
print("different")
end
end
end
not n1 == n2 would not work. Using not before a variable assumes it is false for any value, but true if the value is false or nil. Simply typing this on the command bar outputs this:
local votedConcorrents = {"apple","apple","orange","cheese"}
local alreadyMentionedConcorrents = {"name"}
n1 is an element of the first table whereas n2 represents an element of the second table. Since there aren’t any similarities in any of the given tables, n1 and n2 will never be same and thus,
if n1 == n2 then
print("same")
end
this part will never run. The different part will run every time due to the values never being different.