Skip to main content

Posts

Showing posts with the label operators

What does | in this code mean?

function foo() {} var bar = foo <| function() {}; This is the first time I've seen something like this. What does <| mean? Source: https://github.com/allenwb/ESnext-experiments/blob/master/ST80collections-exp1.js Source: Tips4all

"AND" vs "&&" as operator

Actually, I am facing a codebase where developpers decided to use ' AND ' and ' OR ' instead of ' && ' and ' || '. I know that there is difference in operators precedence ( && goes before ' and '), but with given framework (prestashop to be precise) is clearly not a reason. So, my question: which version are you using? Is ' and ' more readable than ' && '? || there is ~ difference? Source: Tips4all

Java - Order of Operations - Using Two Assignment Operators in a Single Line

What are the order of operations when using two assignment operators in a single line? public static void main(String[] args){ int i = 0; int[] a = {3, 6}; a[i] = i = 9; // this line in particular System.out.println(i + " " + a[0] + " " + a[1]); } Edit: Thanks for the posts. I get that = takes values from the right, but when I compile this I get: 9 9 6 I thought it would have been and ArrayOutOfBounds exception, but it is assigning 'a[i]' before it's moving over the 9. Does it just do that for arrays?