Top "Syntax" questions

Syntax refers to the actual language elements and symbols themselves.

Why does ++[[]][+[]]+[+[]] return the string "10"?

This is valid and returns the string "10" in JavaScript (more examples here): Why? What is happening here?

javascript syntax
Accessing dict keys like an attribute?

I find it more convenient to access dict keys as obj.foo instead of obj['foo'], so I wrote this …

python dictionary syntax attributes
Using the && operator in an if statement

I have three variables: VAR1="file1" VAR2="file2" VAR3="file3" How to use and (&&) operator in if statement …

bash if-statement syntax operators
Else clause on Python while statement

I've noticed the following code is legal in Python. My question is why? Is there a specific reason? n = 5 while …

python syntax while-loop if-statement
Question mark and colon in JavaScript

I came across the following line hsb.s = max != 0 ? 255 * delta / max : 0; What do the ? and : mean in this context?

javascript syntax operators conditional-operator
Dynamic variable names in Bash

I am confused about a bash script. I have the following code: function grep_search() { magic_way_to_define_magic_…

bash variables dynamic syntax
What does the star operator mean, in a function call?

What does the * operator mean in Python, such as in code like zip(*x) or f(**k)? How is it …

python syntax parameter-passing iterable-unpacking argument-unpacking
What is the Java ?: operator called and what does it do?

I have been working with Java a couple of years, but up until recently I haven't run across this construct: …

java syntax ternary-operator conditional-operator
Effects of the extern keyword on C functions

In C, I did not notice any effect of the extern keyword used before function declaration. At first, I thought …

c syntax standards
No Multiline Lambda in Python: Why not?

I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other …

python syntax lambda