Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

-- 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

✓ Accepted answer

Simple:

  • With io.write(), special codes like "/n" and formats like "*s" are possible. io.write() is basically the advanced version of print().

3 comments

0

But i still can print using "\n". Is this an exception?

1

Yes, i suppose so. But print() can't use formats. It's not that smart.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.