Real valued variable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Real valued variable

Suppose that a software developer decides to use a real-valued variable to represent the number of printers connected to a computer. why this is a bad idea?

18th Jun 2019, 5:12 PM
Vrushti Patel
Vrushti Patel - avatar
2 Answers
+ 1
Well, if you're writiting JavaScript, this is what you are doing. Otherwise, it's just silly. If you have a small number of printers it can work, but I'd always fear the equality operator.
18th Jun 2019, 5:19 PM
Vlad Serbu
Vlad Serbu - avatar
+ 1
What about 2.639 connected printers?
18th Jun 2019, 5:45 PM
Bebida Roja
Bebida Roja - avatar