Say you have a variable called hotelPropertyNumber. The contents will always be a number but normally be used as a string. Would there be anything "wrong" with declaring it as a string so that you don't have to continually convert it to a string....or is that a bad programming habit?
Thanks.
A number is a mathematical object used in counting and measuring. If you use your hotelPropertyNumber for counting, i.e. apply any arithmetic operations to it, it is number and should be stored as a numeric type.
If not, then it is not a number; it is a string.
In some languages you can create a user-defined type such as "class HotelPropertyNumber", which:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With