Difference between printf () and writeln () in D

What is the difference between printf("Hello, world!")and writeln("Hello, world!")in the D programming language?

I noticed that it writeln()breaks at the end itself, but printf()not. Is that the only difference?

+4
source share
2 answers

printfcalls the C function and thus works using the C print rules. It is noteworthy that you must get the format string correctly, or you will get stupid. For example, passing intwhen you specified %sinstead %dis likely to crash your program.

writef D , , , , , , , .

writefln - writef, .

+6

printf, C, . (, printf("number = %d", 123) " = 123" )

writeln , . (, writeln("number = ", 123) " = 123" )

+2

Source: https://habr.com/ru/post/1616280/


All Articles