Why does this not compile in F#

f#, recursion

Solution

All you're missing are parentheses, as it would compile if it were:

let rec HelloEternalWorld() = 
  Console.ReadLine() |> printf "%s\n"
  HelloEternalWorld()

To define a function with no arguments you need the parentheses to distinguish the function from a simple value.

Problem

This compiles and works: ``` let rec HelloEternalWorld _ = Console.ReadLine() |> printf "Input: %s\n" HelloEternalWorld 0 HelloEternalWorld 0 ``` This does not compile: ``` let rec HelloEternalWorld = Console.ReadLine() |> printf "%s\n" HelloEternalWorld HelloEternalWorld ``` I try to understand why not?

Original source