Symmetric difference: Difference between revisions

Content added Content deleted
m (→‎{{header|Tcl}}: use better template)
Line 553: Line 553:
show diff :a :b ; [Serena Jim]
show diff :a :b ; [Serena Jim]
</lang>
</lang>
=={{header|Lua}}==
<lang lua>A = { ["John"] = true, ["Bob"] = true, ["Mary"] = true, ["Serena"] = true }
B = { ["Jim"] = true, ["Mary"] = true, ["John"] = true, ["Bob"] = true }

A_B = {}
for a in pairs(A) do
if not B[a] then A_B[a] = true end
end

B_A = {}
for b in pairs(B) do
if not A[b] then B_A[b] = true end
end

for a_b in pairs(A_B) do
print( a_b )
end
for b_a in pairs(B_A) do
print( b_a )
end</lang>


=={{header|MATLAB}}==
=={{header|MATLAB}}==