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

What's the difference between the first code and the second code?

What's the difference when using "do"?

First code:

local words = "i failed in math class"
print(words)

Second code:

local words = "i failed in math class"

do
	print(words)
end

If it's useful, then how do I make it useful?

5 comments

0

What is this post?

0

i agree

0

shouldn't it be obvious? other than the words printed

2

There is no difference. Only that the latter is in a different scope. do .. end creates a new empty scope.

0

ok

1 answer

✓ Accepted answer

I suggest the first code shown. That saves time leaving more for actual development. Now if the code was

local words = game.Workspace.String.Value

do
    print(words)
end

then I suggest the second method.

If this helped don't hesitate to mark it as an answer.

1 comment

0

Thanks <3

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