What does ; mean?

I am seen many developers use this symbol when coding in Roblox Studio. What does it mean and when do you use it?

Symbol: ;

It’s just an endline symbol. It really doesn’t have any use anymore, so you can just ignore it / not use it.
It’s more commonly used in other programming languages, such as c++, but not lua

6 Likes

So there is no purpose in them. Do developers just form a habit from using them in other coding languages?

Most likely, yeah. If you are learning a new language as well, it can be good to help form a habit, but otherwise it’s pointless

1 Like

Like what @SeargentAUS said, ; is a endline/statement operator that are used in other programming languages.

There are some minor use cases to it in Luau, like as an alternative to delimiting tables. Read more about the uses here.

local table = {
	a = 1; -- you can use ; instead of , (but you should still probably stick to commas)
	b = 2;
	c = 3
}

Other than that, it’s just syntax.

1 Like

It’s an example of “Then so, then so, then so.”

Script (Example):

local leaderstats_example = { -- Basically, it redirects the number of the stats you had. Example: if you have a number that is like 31, it's gonna be Nonillion (No for short)
	K = 4;
	M = 7;
	B = 10;
	T = 13;
	Qd = 16;
	Qn = 19;
	Sx = 22;
	Sp = 25;
	Oc = 28;
	No = 31;
	De = 34;
	UDe = 37;
	DDe = 40;
	TDe = 43;
	QdDe = 46;
	QnDe = 49
}

I stopped at 49 (QnDe) because if i continue all away up to 308 it’s gonna do alot of scripting and i will lose alot of time.

1 Like

There is a small use to it that others here haven’t talked about yet and that is to clear ambiguity where type assertation :: is used with parentheses after an assignment or function call. Here is an example:

function setPlayerHumanoidState(player: Player): ()
    local character: Model = player.Character or player.CharacterAdded:Wait()
    (character:WaitForChild("Humanoid") :: Humanoid):ChangeState(Enum.HumanoidStateType.Dead)
    --Luau will throw syntax error here for "Ambiguous syntax: this looks like an
    --argument list for a function call, but could also be a start of new statement;
    --use ';' to separate statements" which is one of the rather rare cases where
    --semicolon is necessary.
end
1 Like