Kozz
Kozz2y ago

bfrisco – 00-42 Jan 1

Is there a purpose of what I am dubbing as "blanket brackets" within functions? Example:
await socket.connect({host, port, timeout: 5000});
{ // <--- what is this?
socket.writeVarInt(0x00);
socket.writeVarInt(50);
// ...
}

let response;
// ...
await socket.connect({host, port, timeout: 5000});
{ // <--- what is this?
socket.writeVarInt(0x00);
socket.writeVarInt(50);
// ...
}

let response;
// ...
I've seen this a couple times in open source repos, wondering if that's just an oversight or if this actually does something.
7 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Kozz
Kozz2y ago
If no variables are defined inside of it, is it just meaningless then?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Kozz
Kozz2y ago
From a functional standpoint Ok, thanks Ah okay, I do see comments on top of each now. It must just be a visual thing like you said. Nice to know about the variable scoping though.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Kozz
Kozz2y ago
In this case it makes a lot of sense (writing packets)
reactibot
reactibot2y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1058907946312028200