Lädt...


🔧 5. Operators(if, else if, else, ternary operator, switch)


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

a) Quyidagi kodda if, else if, else qismi qanday ishlaydi?

int x = 10;

if (x < 5) 
{
    Console.WriteLine("Less than 5");
} 
else if (x == 10) 
{
    Console.WriteLine("Equal to 10");
} 
else 
{
    Console.WriteLine("Greater than 5");
}

Bu kodda x 10 ga teng. Shuning uchun if (x < 5) sharti noto'g'ri bo'ladi va bu kod ishlamaydi.

Keyin, else if (x == 10) sharti tekshiriladi va bu to'g'ri bo'lgani uchun, "Equal to 10" ekranga chiqariladi.

else qismi esa ishlatilmaydi, chunki oldingi shart bajarildi.

*b) Ternary operatorning sintaksisi qanday? Misol keltiring: *

Sintaks: shart ? True : False

c) Quyidagi kodda switch qismida qaysi natija chiqadi?

int day = 3;

switch (day) 
{
    case 1:
        Console.WriteLine("Monday");
    break;
    case 2:
        Console.WriteLine("Tuesday");
    break;
    case 3:
        Console.WriteLine("Wednesday");
    break;

    default:
        Console.WriteLine("Invalid day");
    break;
}

Kodda case 3 bo'lganda break komandasi darhol ishlaydi va Console.WriteLine bloki bajarilmaydi. Shuning uchun hech qanday natija chiqmaydi.

...

🔧 Operators (if, else if, else, ternary operator, switch)


📈 71.14 Punkte
🔧 Programmierung

🔧 Operators (if, else if, else, ternary operator, switch)


📈 71.14 Punkte
🔧 Programmierung

🔧 20. Operators (if, else if, else, ternary operator, switch)


📈 71.14 Punkte
🔧 Programmierung

🔧 Operators:If,else if,else,ternary operator,switch


📈 71.14 Punkte
🔧 Programmierung

🔧 Operators(if, else if, else, ternary operator, switch)


📈 71.14 Punkte
🔧 Programmierung

🔧 5. Operators(if, else if, else, ternary operator, switch)


📈 71.14 Punkte
🔧 Programmierung

🔧 5.Operators (if, else if, else, ternary operator, switch)


📈 71.14 Punkte
🔧 Programmierung

🔧 Operators (if,else if,ternary operator,switch)


📈 60.7 Punkte
🔧 Programmierung

🔧 5. Operators(if, else if, ternary operator, switch)


📈 60.7 Punkte
🔧 Programmierung

🔧 28.0perators (if, else if, else, ternary operator, switch)


📈 59.02 Punkte
🔧 Programmierung

🔧 20. Operators( if, else if, else, ternaty operator, switch)


📈 49.31 Punkte
🔧 Programmierung

🔧 Python Ternary Operator – Conditional Operators in Python


📈 45.31 Punkte
🔧 Programmierung

🔧 Why a Ternary Operator is not a Conditional Operator in JS


📈 44.52 Punkte
🔧 Programmierung

🔧 Don't nest ternary operators. Please!


📈 33.96 Punkte
🔧 Programmierung

🔧 Unary, Binary, and Ternary Operators in JavaScript – Explained with Examples


📈 33.96 Punkte
🔧 Programmierung

🔧 Read This if You Hate Ternary Operators


📈 33.96 Punkte
🔧 Programmierung

🔧 Read This if You Hate Ternary Operators


📈 33.96 Punkte
🔧 Programmierung

🔧 Ternary Operator in JS: Everything you need to know


📈 33.18 Punkte
🔧 Programmierung

🔧 Mastering the JavaScript Ternary Operator: A Comprehensive Guide


📈 33.18 Punkte
🔧 Programmierung

🔧 How to Write Cleaner JavaScript Code with The Ternary Operator


📈 33.18 Punkte
🔧 Programmierung

🔧 Delphi's Ternary Trick: IfThen vs. C's Conditional Operator


📈 33.18 Punkte
🔧 Programmierung

🔧 What is The Ternary Operator In JavaScript ?


📈 33.18 Punkte
🔧 Programmierung

🔧 Short-Circuiting Conditions in JavaScript: The Ternary Operator ES6


📈 33.18 Punkte
🔧 Programmierung

🔧 If to be or not to be is the question, ternary operator is the answer


📈 33.18 Punkte
🔧 Programmierung

🔧 How to Use the Ternary Operator in JavaScript – Explained with Examples


📈 33.18 Punkte
🔧 Programmierung

🔧 JavaScript Ternary Operator – Syntax and Example Use Case


📈 33.18 Punkte
🔧 Programmierung

🔧 Quick Tip: How to Use the Ternary Operator in JavaScript


📈 33.18 Punkte
🔧 Programmierung

🔧 If, Else, Else If, and Switch JavaScript Conditional Statement


📈 25.84 Punkte
🔧 Programmierung

🔧 34.Operators (Bitwise Operators)


📈 24.25 Punkte
🔧 Programmierung

🔧 Operators (Logical Operators)


📈 24.25 Punkte
🔧 Programmierung

🔧 33.Operators (Logical Operators)


📈 24.25 Punkte
🔧 Programmierung

🔧 33.Operators (Logical Operators)


📈 24.25 Punkte
🔧 Programmierung

🔧 JavaScript Operators and Operator Precedence – Beginner's Guide


📈 23.47 Punkte
🔧 Programmierung

matomo