Functions
Native ISI functions were added in ISI [[isiVersionCommit:A2]]
There will be C++ Functions added in ISI [[isiVersionCommit:A3]]
Functions are the most important part of any programming language,
as they allow for repeating code in a clean way.
Creating functions is extremely similar to C++,
first you specify the data type, then you name the function,
and you add arguments separated by commas.
After that, you put code that the function executes in curly brackets.
Example:
int myFunction(int argument1, float argument2, string argument3){
print(argument1, argument2, argument3, "\n");
return 0;
}
To call a function, you do this:
myFunction(1, 3.141, "text");
Functions introduce a new keyword, '
return'.
Return simply returns a value int non-void functions.
[[code-begin]]int add(int a, int b){
return a + b;
}
print(add(2,4),"\n");
[[code-end]]
This code prints 6, because print() takes the returned value of add()
as an argument.
C++ Functions
C++ Functions work as extensions to the language.
[[legacyFeature]]
[[oldReadd]]
[[docVersion]] [[isiVersionCommit:A3]]