What is type of foo, if foo != foo?
-
Isn't it amazing, how NaN is a number, how a number is a word and how a word is a string. :doh:
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
yup, the NaN stuff is amazing, but not sure about 'how a number is a word and how a word is a string' :confused:
-
yup, the NaN stuff is amazing, but not sure about 'how a number is a word and how a word is a string' :confused:
Great that you already know the NaN is a number. Now, if you have ever programmed in low-level, you would know that a word is a size given to a data, 1 byte, 2 byte etc. So the size of the register in CPU is a word; pre-defined size, doesn't matter 8-bit 16-bit or what. The size is number, thus, a number is word. :-) Now a word in our language, for example, "Hello", cannot be represented as a word in computer which needs some other type, which is string (array of characters), thus a word is a string. From here comes the metaphor, In programming, a number is a word and a word is a string. :cool:
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
Great that you already know the NaN is a number. Now, if you have ever programmed in low-level, you would know that a word is a size given to a data, 1 byte, 2 byte etc. So the size of the register in CPU is a word; pre-defined size, doesn't matter 8-bit 16-bit or what. The size is number, thus, a number is word. :-) Now a word in our language, for example, "Hello", cannot be represented as a word in computer which needs some other type, which is string (array of characters), thus a word is a string. From here comes the metaphor, In programming, a number is a word and a word is a string. :cool:
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
Do you have any reference documentations for it? I want to learn about it more in-depth. Thanks!
-
Isn't it amazing, how NaN is a number, how a number is a word and how a word is a string. :doh:
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
Afzaal Ahmad Zeeshan wrote:
Isn't it amazing, how NaN is a number
Yes! Especially since NaN is short for "Not a Number"! X| My whole life is a lie!
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
Do you have any reference documentations for it? I want to learn about it more in-depth. Thanks!
Sure, read about Word in computer architecture[^] and the string data type[^]. One thing you should know is that there is no actual string type, it is just an array of characters. :-) Good luck for more in-depths.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
Afzaal Ahmad Zeeshan wrote:
Isn't it amazing, how NaN is a number
Yes! Especially since NaN is short for "Not a Number"! X| My whole life is a lie!
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
Clarified, but how is a number a word (the size of register) and how is a word actually a string (the data type)? :laugh: Plus, short form of your life is a lie (removing the F). :cool:
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
Sure, read about Word in computer architecture[^] and the string data type[^]. One thing you should know is that there is no actual string type, it is just an array of characters. :-) Good luck for more in-depths.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
Thanks for it. Have a nice day ahead! :)
-
Recently had been debugging using the browser console, when I found this answer. Can you guess the type of foo here? Is it a string, function or else?
Any after overloading operators...
[www.tamautomation.com] | Robots, CNC and PLC machines for grinding and polishing. [YouTube channel]
-
By definition undefined should be unequal to undefined. Is it? Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
-
Great that you already know the NaN is a number. Now, if you have ever programmed in low-level, you would know that a word is a size given to a data, 1 byte, 2 byte etc. So the size of the register in CPU is a word; pre-defined size, doesn't matter 8-bit 16-bit or what. The size is number, thus, a number is word. :-) Now a word in our language, for example, "Hello", cannot be represented as a word in computer which needs some other type, which is string (array of characters), thus a word is a string. From here comes the metaphor, In programming, a number is a word and a word is a string. :cool:
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
Great explanation of how semantics and jargon are sometimes or often at odds with meaning.
-
Recently had been debugging using the browser console, when I found this answer. Can you guess the type of foo here? Is it a string, function or else?
spoiler alert -- answer is below Opened Chrome Dev console and ran the following.
var x = 'garbage' / 10;
x
NaNx != x // with coercion
truex !== x // even without coercion
truetypeof(x)
"number" -
Recently had been debugging using the browser console, when I found this answer. Can you guess the type of foo here? Is it a string, function or else?
How about
int
?private static System.Random randy = new System.Random() ;
int foo { get { return ( randy.Next() ) ; } }:-D
-
How about
int
?private static System.Random randy = new System.Random() ;
int foo { get { return ( randy.Next() ) ; } }:-D
-
spoiler alert -- answer is below Opened Chrome Dev console and ran the following.
var x = 'garbage' / 10;
x
NaNx != x // with coercion
truex !== x // even without coercion
truetypeof(x)
"number"Awesome :thumbsup:
-
Recently had been debugging using the browser console, when I found this answer. Can you guess the type of foo here? Is it a string, function or else?
NaN