C# conditional operator ❓

Поделиться
HTML-код
  • Опубликовано: 1 фев 2025

Комментарии • 23

  • @BroCodez
    @BroCodez  3 года назад +12

    using System;
    namespace MyFirstProgram
    {
    class Program
    {
    static void Main(string[] args)
    {
    // conditional operator = used in conditional assignment if a condition is true/false
    //(condition) ? x : y
    double temperature = 20;
    String message;
    message = (temperature >= 15) ? "It's warm outside!" : "It's cold outside!";
    Console.WriteLine(message);
    Console.ReadKey();
    }
    }
    }

  • @catescdc8
    @catescdc8 3 года назад +12

    Awesome stuff dude! God bless you and Jesus loves you. I hope your channel takes off! You deserve it. Such quality and helpful content! Thank you for making these!

    • @BroCodez
      @BroCodez  3 года назад +10

      Thank you for the kind words. Jesus loves you too brother.

  • @alexiscoe1040
    @alexiscoe1040 3 года назад +5

    Very interesting, thanks for the video

    • @BroCodez
      @BroCodez  3 года назад

      Glad you enjoyed it

  • @katanimaaaa
    @katanimaaaa 4 месяца назад

    As the guy who knows the basics of c++ and java , I always was writing something like
    ( temperature >= 15 )? message = “It’s warm outside!” : message = “It’s cold outside!”;
    This is much more elegant and easier to read. Thanks bro

  • @LunarBulletDev
    @LunarBulletDev 2 года назад +1

    Amazing! i was scratching my head on how to use the conditional ternary operator correctly and why it didnt work, turns out you need to assign first a variable whom will recieve the value, just like you did! thanks!

  • @ThilinaTharuphati
    @ThilinaTharuphati Год назад

    Cool Tutorial! So Clear and Easy To Understand .Thank You Bro ❤😘

  • @mohammedalmutairi640
    @mohammedalmutairi640 3 года назад +1

    Thanks, man you explained it better than the other videos Amazing.

  • @spartanranger
    @spartanranger 3 года назад +1

    Thanks for the video Bro.

  • @CGRunLough
    @CGRunLough Год назад

    Awesome dude 👌

  • @recon_p
    @recon_p 2 года назад

    Just what I needed, thanks!

  • @joaquinillo_
    @joaquinillo_ Год назад

    thanks, I searched everywhere but everyone was so fucking cryptic about it and it turns out it is just an if else lmao

  • @budderrar5751
    @budderrar5751 2 года назад

    noice

  • @ZaccoOfficial
    @ZaccoOfficial 7 месяцев назад

    This is my favorite thing ever

  •  3 года назад

    Thanks Bro!

  • @bern2022
    @bern2022 3 года назад

    Thank you

  • @whitedinamo
    @whitedinamo 3 года назад

    lesson check😇
    As a side note, this was the second video that had the likes at 69 before I came along. It hurts my soul to upset the force. lol

  • @Waheedakram_
    @Waheedakram_ Год назад

    cool it is the real bro code

  • @simik4830
    @simik4830 3 месяца назад

    another comment!

  • @definitelynotchris4776
    @definitelynotchris4776 4 месяца назад

    ??:)

  • @LucParent905
    @LucParent905 3 года назад +1

    Thanks Bro!

  • @edinbascausevic420
    @edinbascausevic420 Год назад

    Thanks Bro!