3 ms·
How do you find out what the compiler says for the return type? Is that covered in the book somewhere? I feel like this might help me quite a bit in my strugg
by Lerc 9y ago
How do you find out what the compiler says for the return type? Is that covered in the book somewhere? I feel like this might help me quite a bit in my struggles.
- bbatha 9y agoI commonly let the compiler error out by specifying the wrong type or leaving off a type annotation. For instance, https://is.gd/8lLrY8 https://is.gd/8lLrY8
- steveklabnik 9y agoone way is to do return SOME_EXRPRESSION; and then look at the compiler error. Another way is let () = SOME_EXPRESSION; which works as long as SOME_EXPRESSION is not of type (), but if it compiles, well, you know the type :) Another way is to use some sort of IDE integration that gives you "show me the type on hover".