The curse of different programming languages
I want to show you guys a simple example, why learning different programming languages at the same time can be a pain in the ass. ColdFusion and Javascript are for example 2 scripting languages. Though the code can look partially quite similar there are fundamental differences. The operators "+" and "&" should serve as an example.
ColdFusion
4 + 6 // = 10
"4" + "6" // = 10
4 & 6 // = "46"
"4" & "6" // = "46"
Javascript
4 + 6 // = 10
"4" + "6" // = "46"
4 & 6 // = 4
"4" & "6" // = 4
A short explanation
4 + 6
This is a clear sum of 2 integer values. There is no difference in the 2 languages.
"4" + "6"
Now we have string values instead. Coldfusion doesn't care and converts those values into integer values before the actual sum (10). For Javascript the + turns into a string concatenation, thats why it just combines the two characters ("46").
4 & 6
The "&" is a bitwise "and" in c-like languages. Thats also how Javascript "sees" it(4).
The two numbers are "anded" like this:
4 = 100 in binary (1*4 + 0*2 + 0*1)
The bitwise "and" only sets 1 if both numbers have a 1 on the corresponding position. Everything else turns 0.
6 = 110 in binary (1*4 + 1*2 + 0*1)
4 = 100
ColdFusion sees the "&" as a string concatenation (as Javascript the "+) and converts the integers into strings to combine the two characters ("46").
"4" & "6"
We know already the different "views" of the language. Javascript wants to bitwise "and" the values and converts the strings into integers in order to do so (4). Coldfusion executes like before without the need of conversion ("46").
Conclusion
Everyone, that is new to programming should avoid to learn more languages at the same time. Some languages may be quite similar and there is not much problem. Nevertheless you will always come to such confusing things. Try to master one language first, before you start with another one. Or better: Only use one ;-)
This Advise can also be given to spoken languages. If languages are completely different you maybe don't have any problem (e.g. dutch + chinese). But for example italian, frensh and spanish are confusingly similar.
The real curse is the Brainfuck programming language. Simple program that prints "Hello World!" looks like this:
++++++++++[>+++++++>++++++++++>+++<<<-]>++.>+.+++++++
..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.
Brainfuck is just a fun language. I am talking about real things...
i must programming with fortran in my masterthesis that was not good
!!" " // true ))
Not in ColdFusion...
But there is
!("n" & "o") // =YES