“Operator bersyarat” Kode Jawaban

Contoh operator bersyarat JS


        
            
        
     var age = 19;
var canDrive = age > 16 ? 'yes' : 'no';
Expensive Eagle

Operator bersyarat

if (x === 5 || x === 7 || x === 10 ||x === 20) {
  // run my code
}
Outrageous Osprey

Operator bersyarat

bCondition1 && bCondition2
Outrageous Osprey

operator bersyarat?:

condition ? consequent : alternative

var rand = new Random();
var condition = rand.NextDouble() > 0.5;

var x = condition ? 12 : (int?)null;

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/conditional-operator
Victorious Vulture

Jawaban yang mirip dengan “Operator bersyarat”

Pertanyaan yang mirip dengan “Operator bersyarat”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya