Hi everyone, I have a problem with fsharp functions. I recently learned this language. I have an array and should fill it using a function. I am trying this
So “sn” is an array of characters and “snj” is a string that holds one line of “DATA.lst”. There is the add function, it is saving each character of “y” which should be “snj” in “x” which will be “sn” but when I am running the program it has a warning. I’ve been looking for information about the functions in f # and reading the manual, but can’t find anything. Could someone help me with this problem?
I didn’t know anything about FS but I will try to take a look and help.
The warning says what happens, the function has a return type ‘bool’, for that reason isn’t a void and you should handle the return of the function, you can ignore the return later, but you must make something with that, receive it or ignore it.
This is the only that I can say because I didn’t know anything about FS, but if for any case is similar to Perl with perlcritic I can say this:
with Perlcritic, you always must return something (anything, a string, number, whatever) and you must handle it (inclusive the built-in void functions like print).
for that is probably that you should receive (or ignore the return of your function and chose what happens with that.
About the functions… You should try to figure out with the documentation of FS (or try the test/error way with prints in all places and try/catch).
Thanks for the advice. I found a system function which is String.ToCharArray () and this helped me solve the problem.