Programming Thread

Viewing single post

Started by the-pi-guy, Mar 13, 2016, 10:39 PM

previous topic - next topic

Legend

So I spent way too much time trying to install a portal virtual machine. But it kept giving an error and the internet wasn't much help.  

Finally gave up.  Installed the regular version.  

After all that I spent a while trying to figure out the syntax for this program.  

Around midnight I was getting prepared to give up and finally some of the test cases were passing.  

Spent about an hour fixing them pretty easily.  Except two were giving bizarre errors that still don't make sense.  I ended up doing something weird.  

1-(2+3) was returning -22, which makes no sense.  However you look at it.  

Then I added 1*1-(2*1+3*1) and suddenly it was parsing correctly.  

I am wondering if JavaScript was taking the numbers as some weird encoded value.  But oh well.  I am done.
Haha yeah 2 and 3 must have been interpreted as strings so adding them produced 23. Multiplying by 1 forced javascript to think of them as numbers.