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

Поділитися
Вставка
  • Опубліковано 29 гру 2024

КОМЕНТАРІ • 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 9 місяців тому

      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 2 роки тому +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 7 місяців тому

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

  • @danyalahmad2097
    @danyalahmad2097 2 роки тому

    Why use enum ????