You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namespace MyLibrary;
class Functional
{
public function map(array! data)
{
return function(number) {
return number * number;
};
}
}
How to do If I want use the data value in the closure like this:
namespace MyLibrary;
class Functional
{
public function map(array! data)
{
return function(number) {
return number * number + data[0];
};
}
}
is Zephir support use like php ?
namespace MyLibrary;
class Functional
{
public function map(array! data)
{
return function(number) use (data) {
return number * number + data[0];
};
}
}
The text was updated successfully, but these errors were encountered:
the code here:https://docs.zephir-lang.com/en/latest/closures.html
How to do If I want use the
data
value in the closure like this:is Zephir support
use
like php ?The text was updated successfully, but these errors were encountered: