Re: Why is typeof(readln) -> void?

2020-07-18 Thread rikki cattermole via Digitalmars-d-learn
On 18/07/2020 9:14 PM, blizzard wrote: Can anybody explain the difference between readln() and readln? I read somewhere that the () were optional, so why this difference? The brackets are optional when calling a function. You are not calling a function if you wrap it in typeof. "The

Why is typeof(readln) -> void?

2020-07-18 Thread blizzard via Digitalmars-d-learn
``` import std.stdio; void main() { writeln(typeof(readln()).stringof); // string writeln(typeof(readln).stringof); // void } ``` Can anybody explain the difference between readln() and readln? I read somewhere that the () were optional, so why this difference?