user34344: I recently came across this code in a tutorial. The code works, but this form of syntax seems to differ quite a bit from https://www.arduino.cc/reference/en/language/structure/control-structure/if/, as it's lacking comparison operators and curly braces for statements. Can someone please run down why this works?
for (int i = 0; i < 15; i++)
{
lcd.setCursor(i, 1);
if (pressed[i])
  lcd.print("X");
else
  lcd.print(" ");

if (justpressed[i])
  digitalWrite(led, HIGH);
else
  digitalWrite(led, LOW);
 }


user45984: 
if (something) is the same as if(something!=0), if condition is a non-zero value, it is considered as fulfilled condition, read about the Conditionals - The true or false story
For single line statements you don't need to use curly braces. But using the braces makes the code more readable and the code is less prone to errors


user31105: About the missing conditions, e.g.:
if (pressed[i])

If is supposed to be a boolean, this is the prefered way, as long as the boolean has value zero (0) when false and nonzero when true. It is the same as writing:
if (pressed[i] != 0)

It is not usual to do this for integers, only for booleans.
About the brackets: If you have only one statement the brackets can be omitted. But it is quite a bad programming practice, since sooner or later you add a statement, without the brackets added and you have a bug introduced.
If you really want to shorten it than instead of
if (justpressed[i])
  digitalWrite(led, HIGH);
else
  digitalWrite(led, LOW);

use
digitalWrite(justpressed[i] ? HIGH : LOW);

This is called the Ternary operator.
update
Using the remark of wondra but with the ternary operation your code can be
for (int i = 0; i < 15; i++)
{
    lcd.setCursor(i, 1);
    lcd.print   (     pressed    [i] ? "X"  : " ");
    digitalWrite(led, justpressed[i] ? HIGH : LOW);
}


34344: <p>I recently came across this code in a tutorial. The code works, but this form of syntax seems to differ quite a bit from <a href="https://www.arduino.cc/reference/en/language/structure/control-structure/if/" rel="noreferrer">https://www.arduino.cc/reference/en/language/structure/control-structure/if/</a>, as it's lacking comparison operators and curly braces for statements. Can someone please run down why this works?</p>

<pre><code>for (int i = 0; i &lt; 15; i++)
{
lcd.setCursor(i, 1);
if (pressed[i])
  lcd.print("X");
else
  lcd.print(" ");

if (justpressed[i])
  digitalWrite(led, HIGH);
else
  digitalWrite(led, LOW);
 }
</code></pre>
 45984: <ol>
<li><strong>if (something)</strong> is the same as <strong>if(something!=0)</strong>, if condition is a non-zero value, it is considered as <a href="https://www.le.ac.uk/users/rjm1/cotter/page_37.htm" rel="nofollow noreferrer">fulfilled condition</a>, read about the <a href="http://www.cplusplus.com/forum/articles/3483/" rel="nofollow noreferrer">Conditionals - The true or false story</a></li>
<li>For single line statements you don't need to use curly braces. But using the braces makes the code more readable and the code is <a href="https://stackoverflow.com/questions/12193170/whats-the-purpose-of-using-braces-i-e-for-a-single-line-if-or-loop">less prone to errors</a></li>
</ol>
 31105: <p>About the missing conditions, e.g.:</p>

<pre><code>if (pressed[i])
</code></pre>

<p>If is supposed to be a boolean, this is the prefered way, as long as the boolean has value zero (0) when false and nonzero when true. It is the same as writing:</p>

<pre><code>if (pressed[i] != 0)
</code></pre>

<p>It is not usual to do this for integers, only for booleans.</p>

<p>About the brackets: If you have only one statement the brackets can be omitted. But it is quite a bad programming practice, since sooner or later you add a statement, without the brackets added and you have a bug introduced.</p>

<p>If you really want to shorten it than instead of</p>

<pre><code>if (justpressed[i])
  digitalWrite(led, HIGH);
else
  digitalWrite(led, LOW);
</code></pre>

<p>use</p>

<pre><code>digitalWrite(justpressed[i] ? HIGH : LOW);
</code></pre>

<p>This is called the <a href="https://en.wikipedia.org/wiki/%3F:#C" rel="nofollow noreferrer">Ternary operator</a>.</p>

<p><strong>update</strong></p>

<p>Using the remark of wondra but with the ternary operation your code can be</p>

<pre><code>for (int i = 0; i &lt; 15; i++)
{
    lcd.setCursor(i, 1);
    lcd.print   (     pressed    [i] ? "X"  : " ");
    digitalWrite(led, justpressed[i] ? HIGH : LOW);
}
</code></pre>
