Re: Object to Atom
- Posted by evanmars Jul 03, 2013
- 1245 views
DerekParnell said...
evanmars said...
object s = {2} atom my_atom if sequence(s) then if length(s) = 1 then my_atom = s[1] end if end if ? my_atom
This is not very robust coding. If 's' is not a sequence or has a length other than 1, then 'my_atom' will not have been assigned anything, so it may crash the program later when you try to use it for anything.
True. I would normally have done something like:
atom my_atom = -1 --or atom my_atom = 0
when declaring it.