Closed avidseeker closed 1 year ago
You misunderstand the use of keyword
. First consider this example:
real f(real m) {return m*2;}
real f(real n) {return n;}
write(f(2.0), f(3.0), file=stdout);
The second function has the same signature as the first and therefore overrides (replaces) it. Adding keyword
to these signatures forces the user to explicitly specify the argument name (in this case n
, not m
). Just like in mathematics, if you want to use two different functions having the same signature, you will need to distinguish them by giving them different names (like f
and g
).
results in
despite having
m,n
as mandatory keyword parameters.