Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Difference between io.write () and print ()?

Asked by
D3LTA_Y 72
6 years ago
-- Made by Lunatic_o;

io.write("Hello, world!\n");
print("Hello, world!");

What is the difference? Does here exist two methods to do the same thing?

1 answer

Log in to vote
-1
Answered by 6 years ago

Simple:

  • With io.write(), special codes like "/n" and formats like "*s" are possible. io.write() is basically the advanced version of print().
0
But i still can print using "\n". Is this an exception? D3LTA_Y 72 — 6y
1
Yes, i suppose so. But print() can't use formats. It's not that smart. DeceptiveCaster 3761 — 6y
1
This is wrong. Neither can use formats. Both output text verbatim to standard output. `'\n'` are not formats but "escape sequences", which serve as a way to introduce special characters like new lines or TABs `'\t'`. The difference is `print()` will add a newline, `io.write()` will not. Link150 1355 — 6y
Ad

Answer this question