I’m new to F#, but when I use verbose syntax
to put a for loop in another one,
it will not compile:
#light "off"
let Multiple9x9 () =
for i in 1 .. 9 do
printf "\n";
for j in 1 .. 9 do
let k = i * j;
printf "%d x %d = %2d " i j k ;
done;;
done;;
Multiple9x9 ();;
printf "\n" ;;
I know it will work with #light “on”:
let Multiple9x9 () =
for i in 1 .. 9 do
printf "\n"
for j in 1 .. 9 do
let k = i * j
printf "%d x %d = %2d " i j k
Multiple9x9 ()
printf "\n"
If you’re going to use the verbose syntax you need
inafter eachletbinding. Also, you don’t need;;afterdonein the inner loop: it makes the outer loop incomplete (cutting off the outerdone).Here’s the corrected code: