Hi All,
I am trying to build a function which takes words as the input and checks them against a table:
Colour = collect(“BROYWGIP”)
Colourtable = Table(name = [“Black”, “Red”, “Orange”, “Yellow”, “White”, “Green”, “Blue”, “Purple”], symbol = [Colour[1], Colour[2], Colour[3], Colour[4], Colour[5], Colour[6], Colour[7], Colour[8]], number = [0, 1, 2, 3, 4, 5, 6, 7])
function Check(x)
v = map(@Compute($name == x), Colourtable)
s = Int
for i in 1:8
if v[i] == true
push!(s,1)
elseif v[i] == false
push!(s,0)
else
return “Error”
end
end
a = Table(name = [“Black”, “Red”, “Orange”, “Yellow”, “White”, “Green”, “Blue”, “Purple”], present = [s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8]]),
b = Table(Colourtable; present = a.present)
end
I wrote the code as this but I am having an issue getting the initial variable x to be recognised in the v = map part.
Can anyone help suggest a work around?
All the best,