Swift For Beginners - Loops (For, While, Repeat)

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

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

  • @seanallen
    @seanallen  5 лет назад

    Watch Next - iOS Dev Job Interview Practice - Take Home Project Course - ruclips.net/video/MSIe2y6Fee8/видео.html

  • @JasonMitchellAZ
    @JasonMitchellAZ 4 года назад +6

    I love that roadrunner/coyote illustration for a good repeat-while explanation

    • @seanallen
      @seanallen  4 года назад +1

      It's a good one

    • @mattkruckeberg9798
      @mattkruckeberg9798 4 года назад +1

      Haha. Just saw that. May need to find that for Wednesday

    • @stefan_dudu
      @stefan_dudu 4 года назад +1

      Fan of your podcast!

  • @lycansre
    @lycansre 5 лет назад +2

    dude i love your videos i am saving them for watch later, however this one is awesome.

    • @seanallen
      @seanallen  5 лет назад +1

      Happy to hear that you enjoy them, Meshall 😀

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

    Sean's response to Lebron's score at 15:18 lol

  • @multitudes389
    @multitudes389 4 года назад +3

    That coyote illustration! Will never look at a repeat/while loop the same way again 😂

    • @seanallen
      @seanallen  4 года назад

      Haha, I thought it was great too.

  • @brianb2087
    @brianb2087 4 года назад +2

    GREAT TUTORIAL, JUST WHAT I NEEDED...THX!!! LOVED THD ROADRUNNER CARTOON :-)

  • @erhanbakrc6619
    @erhanbakrc6619 4 года назад +2

    Very educational, thanks

    • @seanallen
      @seanallen  4 года назад

      Glad you liked it, Erhan 😀

  • @It_z_me_vj
    @It_z_me_vj 5 лет назад +1

    Could you please Explain briefly about GCD and ARC

    • @seanallen
      @seanallen  5 лет назад +1

      I have an older video that goes into that a bit. ruclips.net/video/VcoZJ88d-vM/видео.html

    • @It_z_me_vj
      @It_z_me_vj 5 лет назад

      Yeah I saw that but I wanna learn little bit more stuff on the same Kindly do the one video about GCD & ARC

  • @macshawn4057
    @macshawn4057 5 лет назад

    Back at it again. Thanks brother

  • @Tenly2009
    @Tenly2009 5 лет назад +2

    NOT JUST FOR BEGINNERS!!!
    (Paused again at 10:46 to say OMG!)
    I have 1 app on the App Store and 3 others that are being tested on TestFlight - so I’d be hard pressed to call myself a beginner at this point.
    My apps use dictionaries and arrays all over the place - and omg have I been making things so hard on myself! I had no idea that a For statement could have a where clause - and I had no clue that I could get Key and Value together so easily when looping through a dictionary!!!
    To put this discovery into the proper context. Here is what I’ve been doing to iterate through my dictionaries:
    someDict[String:Any] (data returned from Firebase)
    for key in someDict.keys {
    let dictKey = key
    var dictVal:[String] = []
    if let val = someDict[key] as? [String] {
    dictVal = val
    }
    }
    So ugly - right? OMG - this video is going to improve my coding dramatically. Thank you, thank you, thank you!!!

    • @bonnydonny
      @bonnydonny 4 года назад +1

      Yeah, I'm not a beginner either, but I still enjoy Sean's videos because several things I thought I knew I really wasn't clear on. Oh, and I feel "so superior" when I know more than he is showing... Which is a good teaching style that helps build the confidence of the student. Sean is honest. He shares through his mistakes and keeps the flow of incremental coding going. Yes, I want more advanced "lessons," but I get a lot out of watching and listening to Sean every time I do. I'm sure it isn't easy to keep working on these videos for us all to enjoy without some good feedback every now and then.

    • @seanallen
      @seanallen  4 года назад

      @Tenly2009 Nice! I try to put little gems in all my videos if I can. I was hesitant to call this a beginner video (even though it's aimed at beginners) because I figured there's be some insights that even experienced developers might not be clear on.

    • @seanallen
      @seanallen  4 года назад

      @Don Sleeter - Thanks for the kind words and feedback Don!

  • @bdaralan
    @bdaralan 5 лет назад +6

    There is a convenient way to go through array’s index and element:
    for (index, player) in nbaAllStars.enumerated() {
    print(“\(index + 1). \(player)”)
    }
    PS: Sean probably cut this out since it’s beginner video.

    • @seanallen
      @seanallen  5 лет назад

      lol, your P.S. was exactly correct. Don't want to throw too much at the viewer and possible overwhelm them since this is meant for absolute beginners.

    • @Tenly2009
      @Tenly2009 5 лет назад

      So - is “index” a special keyword when using enumerated() - or can it be “idx” or “playerIdx” or something else at the programmers whim?
      It’s definitely a good tip. I’ve been using:
      var i = 0
      for player in nbaAllStars {
      i += 1
      print(“\(i). \(player)”)
      }
      Using enumerated() seems much cleaner.

    • @bdaralan
      @bdaralan 5 лет назад +1

      @@Tenly2009 It can be anything.

  • @markme7092
    @markme7092 5 лет назад +1

    Good video! Please make video on Core Data

  • @mattkruckeberg9798
    @mattkruckeberg9798 4 года назад +2

    I didn’t know there was a Bool.Random(). Pretty neat. How long has that been around?

    • @seanallen
      @seanallen  4 года назад +1

      I believe Swift 4.2

  • @jenson.developer
    @jenson.developer 4 года назад +1

    Thanks for the video. ❤️

  • @Tenly2009
    @Tenly2009 5 лет назад +1

    Hey Sean... great video as always. Will definitely be sitting my son down in front of your “Beginner Series” videos.
    Just one piece of constructive criticism so far (I paused at 4:40 to write this comment):
    Had I been an actual beginner, I would have become distracted by your use of “0..

    • @bonnydonny
      @bonnydonny 4 года назад +1

      You have discovered one of Sean's effective teaching techniques... introduce syntax or concept in real usage, then explain it later when it the usage story/result has been completed. Repeating later to solidify the new term.

    • @seanallen
      @seanallen  4 года назад

      You're on to me, Don...

  • @DimitrisTheo
    @DimitrisTheo 5 лет назад +1

    Nice video keep up the good work ✌🏻💪🏻

    • @seanallen
      @seanallen  4 года назад +1

      Happy that you liked it!

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

    how does the code know player? as player has not been assigned to anything? is it a variable?

  • @sunnypatel4796
    @sunnypatel4796 5 лет назад +1

    Hey Sean nice and short video covers loops perfectly and the explanation is too the point. Especially like the analogy of while and repeat while. Have you thought of making videos on data structures and algorithms using swift or can you suggest some good books to me for learning data structures and algorithms because I feel I am very week at that and wanting to improve as it has been asked in many of my interviews and I suck in that.

    • @seanallen
      @seanallen  4 года назад +1

      I don't know if I'd call it "short", but happy to hear you liked the video and enjoyed the analogy at the end 😂

    • @sunnypatel4796
      @sunnypatel4796 4 года назад

      Sean Allen 🤣

  • @dominikkotlarczyk6006
    @dominikkotlarczyk6006 4 года назад

    Good as always ;) Thanks!

  • @_marlon
    @_marlon 4 года назад +1

    Should've thrown Kobe in the mix as a tribute! 😜 Great video!

    • @seanallen
      @seanallen  4 года назад +1

      That would have been a great idea...

    • @_marlon
      @_marlon 4 года назад +1

      Sean Allen Also, that dunk by Lebron was such an epic in game dunk! Love that you threw that in the video!

  • @jbaughman85
    @jbaughman85 4 года назад

    Is it hard to get an iOS job only knowing Swift? I feel like most job postings say they want you to know multiple languages.

    • @seanallen
      @seanallen  4 года назад

      No. If you're applying for an iOS developer job at a company, the vast majority of the time there's not an expectation that you know multiple languages. It can be helpful and a nice bonus, but not a requirement.

  • @meepable
    @meepable 4 года назад

    Thanks for the explanation of 0..< that threw me off /java programmer

  • @lantua
    @lantua 4 года назад

    Given same condition, same loop content, and of course assuming condition is side-effect free as it should be. The only difference between while vs repeat-while (do-while elsewhere) is at the first loop.
    If while run once, so does repeat-while.
    If while run twice, so does repeat-while, and so one.
    If while doesn’t run, repeat-while run once, which is the sole difference in behavior.

    • @lantua
      @lantua 4 года назад

      The check-before-do vs do-before-check is a myth really, since you always check before doing the *next* one. The question is really if you check before doing the *first* one.

  • @musicforalifetime133
    @musicforalifetime133 4 года назад

    Can you split the videos into "While", "Repeat", and "For"

  • @manofqwerty
    @manofqwerty 4 года назад

    I've never looked at swift, from this video is seems like a strange baby of Python and JavaScript

  • @TheSkelpil
    @TheSkelpil 4 года назад +1

    A little bit too fast-paced for a beginner but still very good video

    • @seanallen
      @seanallen  4 года назад

      Thanks for the feedback. I'll keep that in mind (genuinely, sometimes text can sound sarcastic 😀)

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

    why would I want to run before checking if I'm on the edge. That would be disastrous lol. great content !!!!

  • @petersuwara5432
    @petersuwara5432 4 года назад

    Some feedback to the Swift Devs. The pace of language evolution is so fast that a lot of devs are just over the constant need to re-write and update. Unlike python, which is stable, the core team works on developing support infrastructure and libraries. This came up when thinking about SwiftUI. The paradigm shift and changes are so big, than no big studio or team is thinking of using it, even for new apps.
    Some large apps I work with are still in Objective-C due to the cost of re-rewrite, and Objective-C is stable. The swift people need to really slow down with the language changes and focus on support libraries.
    It's getting out of hand.
    * END RANT *

  • @nikaiobishvili6149
    @nikaiobishvili6149 4 года назад

    you speak so quick, It is hard to follow you but I interest in your lessons very much:((((

  • @libvlog2264
    @libvlog2264 4 года назад +1

    Bool.random() 😱♥️

    • @Asdfghjkl-vh4ut
      @Asdfghjkl-vh4ut 4 года назад

      D O C true

    • @seanallen
      @seanallen  4 года назад +1

      Glad you liked that. You just inspired me to make a video on all the uses of .random() since it's relatively new in Swift. Many may not be aware of all the uses.

  • @TETONSNOBOTS
    @TETONSNOBOTS 4 года назад

    I went to DevMountain and I would definitely not recommend it.

  • @aaronmendez9284
    @aaronmendez9284 5 лет назад

    FIRST COMMENT! :D