I'm new to mathematica so I hope this is not a too stupid question, but I couldn't find a solution in the mathematica documentation.
I've got a normal table, initialized with "0" as entries. In the first element, I want to put a List of few numbers. I tried to build a minimalistic example as follows:
visitedNodes = Table[0,{i,1,5}]
visitedNodes[[1]] = List[1,2,3]
so visitedNodes = {{1,2,3},0,0,0,0}. Now I test:
For[i=1, i <= Length[visitedNodes], i++,
If[visitedNodes[[i]] != 0,
a = 5; (* like: "do something" *)
Print["I'm in!"];
];
];
Since it's a "List Object", for me it's != 0, but guess I have to test it on somewhat else... but on what? :) Thank you a lot, this site also helped me already a lot =).
Edit: The question is, that the If statement for i=1 should be like "Yes, a List[1,2,3] is not equal 0, since it's the first element of visitedNodes", but it does not. So why is it like that?