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
Functions in Mastermind work more like templates/macros, as they do not perform any passing by value. All functions are essentially inlined at compile time. This means multiple calls to a large function will significantly increase your compiled code size.
2
+
3
+
Functions are created using the def command followed by the function name and a list of typed arguments inside of
4
+
( ).
5
+
6
+
Functions currently do not support return values since they function as marcos and will instead just update the value of variables passed in
7
+
8
+
```
9
+
def quote(cell arg) {
10
+
output 39; // ASCII single quote
11
+
output arg;
12
+
output 39;
13
+
}
14
+
15
+
cell N = 'g';
16
+
quote<N>;
17
+
N += 3;
18
+
quote<N>;
19
+
//OUTPUT
20
+
// 'g''j'
21
+
```
22
+
23
+
When Structs are used in conjunction with Functions you are allowed to define multiple functions with the same name and it
24
+
will use the input to perform function overloading.
0 commit comments