With C, I can write a program with a generic text editor (i.g. nano) and compile it in the Lunix terminal with
gcc mySum.c -o mySum
to get a window asking for inputs and returning the output.
#include <stdio.h>
int main(){
int x;
int y;
int sum;
printf("Program that sums two numbers.\n\nPlease type the first one:\n");
scanf("%d", &x);
printf("Type the second one:\n");
scanf("%d", &y);
sum = x + y;
printf("The sum of %d and %d is %d\n", x, y, sum);
return 0;
}
Can I produce the same kind of program in F#, without Visual Studio/MonoDevelopment?
I found very instructive for me working with a nude text editor, like I am doing with C. It imposes me to be more concentrated on learning, with less help by the IDE. Furthermore, a text editor (such as nano, or notepad++ or whatever) provides more flexible tools than fsharpi
to write the progra canm. In this way, when the program is completed, I give it to the compiler in the same way I did with C in the example.
I would say by implementing the function
let mySum x y =
x + y
with
fsharpc mySum.fs
but I fail to get how to achieve it. I found this reference but it is a little advanced.