Did you know that when type-checking, you can add a question mark to make optional type-checking? Most programmers do it this way:
function PrintMessage(Message)
print(Message or "Hello world!")
end
PrintMessage()
However, you can also do this as well, just in case if you like to use type-checking like I do:
function PrintMessage(Message: string?)
print(Message or "Hello world!")
end
PrintMessage()
This can be useful in times where you want to add optional type-checking but can’t because of that ‘argument count mismatch’ warning. This might also be useful in other cases too.
Well, that was a rather short, but also informative tutorial. So, did you know that you could add a question mark to make optional type-checking? I hope you found this interesting, and I hope this was a useful topic. See you later!