...

/

The Ternary Operator

The Ternary Operator

Let’s understand how the ternary operator serves as a substitute for the if-else expression in Dart.

We'll cover the following...

Introduction

Dart has an operator that lets you concisely evaluate expressions that might otherwise require if-else statements.

The operator that we will be discussing is the ternary operator which is represented by ?:.

Syntax

Let’s take a look at how this operator is ...