Call another method inside of method closure
Is it possible to add another method inside of a closure, and if so, how to properly do it?
For instance,
As example, I'm grabbing the value of 'stock' field, and run a conditional statement. And if conditions are met, I want to show the hint text, and maybe add another method to that field, like
hintIcon()
of hintColor()
5 Replies
You can execute other methods. But if you want to add hint color you should do that in a separate closure.
So how can I return the string value of the hint if conditions are met?
As you said: return a string
return ('testing')
is enough?Yes.