Saturday, 17 August 2013

None, Some and conditionnal treatments

None, Some and conditionnal treatments

I would like to get this thing:
a variable named abc must be None, except if the result of complicated
treatments is true. I wrote a beginning of answer but it doesn't work:
def abc={
None
copie.getRoot().asInstanceOf[DefaultMutableTreeNode].children() foreach ({
site => <...more things after...>
}
in the you can find the result e.g. Some(site)
but the compiler does not accept this order, I mean "None" followed by
some conditions eventually finishing by Some(xxx). and if I put "None"
after the conditions, the result will always be "None" of course, and it's
not what is expected.
can you tell me if this way can work, and how? Or otherwise how can I
proceed?
thanks
olivier

No comments:

Post a Comment