Code structure. What is "?"

"int dir = (steps > 0)? HIGH:LOW;"
Does the question mark mean random or depending on variable?
I couldn't find anything on the reference page. My google foo is not strong enough to search for a single character to get code definition on it.

Or is it saying if True=HIGH
IF false =LOW?

//////////////////////////////////////////////////////////////////
//©2011 bildr
//Released under the MIT License – Please reuse change and share
//Using the easy stepper with your arduino
//use rotate and/or rotateDeg to controll stepper motor
//speed is any number from .01 -> 1 with 1 being fastest –
//Slower Speed == Stronger movement
/////////////////////////////////////////////////////////////////
  
  //Declares constant varibles that do not change
  #define DIR_PIN 2
  #define STEP_PIN 3


  //Runs once for setup declaring 2 and 3 as Outputs.
void setup() 
{
pinMode(DIR_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
} 

//Main repating loop.
void loop()
{ 
//rotate a specific number of degrees
rotateDeg(360, 1); //Sends 360 and 1 to loop  void rotate rotateDeg and fills them in for Float and speed
delay(1000); // waits one secound
rotateDeg(-360, .1); //reverse
delay(1000); // waits one secound. 
//rotate a specific number of microsteps (8 microsteps per step)
//a 200 step stepper would take 1600 micro steps for one full revolution
rotate(1600, .5); //sends 1600 microsteps in a postive direction at a speed of half.
delay(1000);  //Wait one secound
rotate(-1600, .25); //reverse
delay(1000); // waits one secound.
}

void rotate(int steps, float speed)
{
//rotate a specific number of microsteps (8 microsteps per step) – (negitive for reverse movement)
//speed is any number from .01 -> 1 with 1 being fastest – Slower is stronger
int dir = (steps > 0)? HIGH:LOW;
steps = abs(steps);
digitalWrite(DIR_PIN,dir); 
float usDelay = (1/speed) * 70;
for(int i=0; i < steps; i++)
{ 
digitalWrite(STEP_PIN, HIGH); delayMicroseconds(usDelay); digitalWrite(STEP_PIN, LOW);
delayMicroseconds(usDelay); 
} 
}

void rotateDeg(float deg, float speed)
{ 
//rotate a specific number of degrees (negitive for reverse movement) //speed is any number from .01 -> 1 with 1 being fastest – Slower is stronger
int dir = (deg > 0)? HIGH:LOW;
digitalWrite(DIR_PIN,dir); 
int steps = abs(deg)*(1/0.225);
float usDelay = (1/speed) * 70;
for(int i=0; i < steps; i++)
{ 
digitalWrite(STEP_PIN, HIGH);
 delayMicroseconds(usDelay); 
 digitalWrite(STEP_PIN, LOW);
 delayMicroseconds(usDelay); 
 }
 }

The question mark ? is the conditional ternary operator.

condition ? result1 : result2

If condition is true, the entire expression evaluates to result1, and otherwise to result2.

int dir = (steps > 0)? HIGH:LOW;

This is the same as

if(steps>0)
{dir = HIGH;}
else
{ dir = LOW);

Thx

+Karma

Ternary operator just means that the operator takes three operands. There are unary operators (such as the minus sign in front of an expression) and binary operators (such as a division sign between two expressions).

I think that ?: may be the only ternary operator in C/C++. I am not sure that the operator has a formal name although conditional operator fits, but ?: is known informally as the "Elvis operator". (Look at it sideways and with a lot of imagination.)