Top "Syntax" questions

Syntax refers to the actual language elements and symbols themselves.

How to concatenate string variables in Bash

In PHP, strings are concatenated together as follows: $foo = "Hello"; $foo .= " World"; Here, $foo becomes "Hello World". How is this …

bash shell syntax concat string-concatenation
Insert into ... values ( SELECT ... FROM ... )

I am trying to INSERT INTO a table using the input from another table. Although this is entirely feasible for …

sql database syntax database-agnostic ansi-sql-92
How can I do a line break (line continuation) in Python?

I have a long line of code that I want to break up among multiple lines. What do I use …

python syntax line-breaks long-lines
Putting a simple if-then-else statement on one line

I'm just getting into Python and I really like the terseness of the syntax. However, is there an easier way …

python if-statement syntax ternary-operator
How do I iterate over a range of numbers defined by variables in Bash?

How do I iterate over a range of numbers in Bash when the range is given by a variable? I …

bash shell for-loop syntax
Python integer incrementing with ++

I've always laughed to myself when I've looked back at my VB6 days and thought, "What modern language doesn't allow …

python syntax increment
What is the result of % in Python?

What does the % in a calculation? I can't seem to work out what it does. Does it work out a …

python python-2.7 syntax operators modulo
How do I convert a float number to a whole number in JavaScript?

I'd like to convert a float to a whole number in JavaScript. Actually, I'd like to know how to do …

javascript syntax
What does "use strict" do in JavaScript, and what is the reasoning behind it?

Recently, I ran some of my JavaScript code through Crockford's JSLint, and it gave the following error: Problem at line 1 …

javascript syntax jslint use-strict
What is the preferred syntax for defining enums in JavaScript?

What is the preferred syntax for defining enums in JavaScript? Something like: my.namespace.ColorEnum = { RED : 0, GREEN : 1, BLUE : 2 } // later on …

javascript syntax enums