How to use switch statements to check multiple conditions - Swift for Complete Beginners

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

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

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

    That was the best explanation I’ve heard. Thanks.

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

    I don't get the part with Metropolis... If place is a constant, we can't change it's value, right? So how is switch able to change it's value from Metropolis to Gotham, Mega-City One etc?

    • @DerHardCoreMC
      @DerHardCoreMC 10 месяцев назад

      if you did not figure it out yourself
      place indeed cant be changed, and he did not do that either, the switch case would always just print the default case in the above example ("Who are you")
      The switch case just detects which value "place" has in the moment its called, so you can do different things depending on what the actual value of place is
      if you somehow changed the value of place laterwards (which you cant with a constant) and place would have the value "Gotham", always only ("Youre Batman") would be printed out

  • @NathanBudd
    @NathanBudd 3 года назад +3

    If you've never heard this song... the end of this tutorial is going to be so weird!
    😆
    It was an *excellent* example however!

    • @bobweiram6321
      @bobweiram6321 8 месяцев назад

      Except the number of gifts decrease in thus example, but increases in the song.

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

    Why use enum ????