Most programming languages have a way to declare variables in order to save computing resources and work faster.
For example, in C++, you have to declare the type of a variable first.
int variable = 10;
string coolText = "Not really cool text";
I’m just wondering, should I do the same in Roblox? Like, if I have a boolean value, should I do local variable : boolean = true
?
Or if I have a model variable, should I do local modelVariable : Model = pathToModel
?
Thanks for reading
Lametta
(Lametta)
#2
Just do variable = true
model = workspace.Model
None of that CLASS : stuff
Yea, but I’m just wondering if declaring the data types will be more efficient, even if it’s by a miniscule amount.
You can if you want to, however it’s not a requirement. The main usage for the syntax is for type analysis rather than performance
1 Like
Makes sense, I’ve been using it to access properties of parameters so I was wondering if it would be better if I always used that. Thanks!
system
(system)
Closed
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.