Using Visual Studio 2015 Update 3 and fsi.exe
from F# v4.0 I' trying to run this script:
//error.fsx
#if INTERACTIVE
let msg = "Interactive"
#else
let msg = "Not Interactive"
#endif
let add x y =
x + y
printfn "%d" (add 1 2)
Output: error.fsx(12,15): error FS0039: The value or constructor 'add' is not defined
If I then comment out the #if
-#else
-#endif
block, it works fine:
// fixed.fsx
//#if INTERACTIVE
// let msg = "Interactive"
//#else
// let msg = "Not Interactive"
//#endif
let add x y =
x + y
printfn "%d" (add 1 2)
Output: 3
I'm sure I'm doing something wrong (rather than this being a bug) but I can't for the life of me figure out how to make this work.
Thoughts?