Blockland Forums > Modification Help
How to check if a string variable has nothing?
Reinforcements:
I've tried, I didn't get it to work.
Headcrab Zombie:
if(%string $= "") ?
Penguin/Person:
Why would it have nothing as in the variable hasn't been assigned to anything or nothing as in the variable = 0?
Headcrab Zombie:
I'm not sure I understood what you just said.
If it's a string, you have to use $= ""
if you just use == 0 it will always be true because trying to convert a string to a number will always be 0
Ephialtes:
--- Quote from: Headcrab Zombie on September 14, 2010, 01:34:56 AM ---I'm not sure I understood what you just said.
If it's a string, you have to use $= ""
if you just use == 0 it will always be true because trying to convert a string to a number will always be 0
--- End quote ---
If the string begins with something numeric (e.g. 1234cow) it'd be converted to an integer of 1234 for an integer comparison.