Inline functions and const
-
Since you can't make a const variable declaration in an inline function, is there some other way to make a variable that will be available to outside the inline function code block?
I am making some factory methods and would like to be able include array creation along side the creation of the components.
-
@VirtualVirgin In the inline function put your values into a local variable and return it. Then when you call the inline function you can capture the returned value in a const.
inline function doSomething() { local myVar = 123; return myVar; } const data = doSomething();
I'll be posting a video about this tomorrow :)
-
@d-healey said in Inline functions and const:
inline function doSomething()
{
local myVar = 123;
return myVar;
}const data = doSomething();
I can't figure how how to get any returns out of it if there are parameters going into it.
inline function createMatrixTable(name, rows, columns, unitSize)
-
@VirtualVirgin As the error message says, testReturn is not a function, you don't need to put () at the end.