I know null = “”
but what is nothing?
IF I try to type if null when it isn’t there, it gives me this error.
So yeah, I’m frustarated
I did like… if TheTable’sName[4] == null
And it seems to not be working D:
I know null = “”
but what is nothing?
IF I try to type if null when it isn’t there, it gives me this error.
So yeah, I’m frustarated
I did like… if TheTable’sName[4] == null
And it seems to not be working D:
Trying to index and element outside the range of the list / array is an error, not null.
This situations seems like you should rethink your code, but for now you can try:
var i = 4;
if (list.Count <= i || list[i] == null) {
// foo
}
Null is not “”
Null is nothing.
“” is an empty string.
DanielQuick, tell that to my errors -_- AND to my empty string that counts as null in an if statement.
Your error is due to trying to access something that isn’t there. You should never access an element in a List with an index greater than or equal to the number of elements in the list.
A string can be null or it can be empty. It can’t be both.