QOTD ⚡Have you learned about loops in another programming language before? Let me know! 👇 Kick start your own app with my free 7 Day App Action Plan ➡️ bit.ly/7dplan
This series is awesome! I already know C++ and Java, but skimming this video along with Chris' explanations helps me learn the syntax for Swift 3.1 faster. Subbed.
Hi Chris, I was curious how you would be able to print the results of the for-in statement one by one. A good example I believe would be - when you level up a character its total damage increases by 2 each level. How would we print or insert that data?
Hello, inside the for loop it will go through the data inside "array" or range of values one by one for something like stats you don't need a loop for that, maybe you can just simply access the data and multiply it by a base value (like 2) - Francis
great series I know java and c# but swift is similar which is cool but how do you control the iterator in the for in loop for example lets say you wanted it to subtract instead of add would you have to put 1...-5?. I have never heard of a for in loop until today. Its amazing how swift knows what your implicit variables are but wont that get confusing as a code base grows maybe its just me and im used to explicity setting variables to types.
Hey Rubensito, each time it loops, it's adding the next number to the sum. So it's 1 + 2 + 3 + 4 + 5 and then it prints out the total after all the loops.
Hey Trent, it's just a variable name and you can specify any name you'd like. When you access that variable inside the loop, it gives you the number in your looping range that it is currently on.
Hey chris I’m watching this video and when typing in my “sum+= index” i get a pop up that says it cannot concert value of type (unsafe pointer ) could you help me explain why I get this pop up and how I can fix it if it’s not too much of a hassle? Thanks chris love the videos !
That's weird, especially with something as basic as an addition. Did you let some space between sum and +. Sometimes sum+ and sum + can mean 2 different things. I'm curious to see a screenshot of this, can you post it on our support page? bit.ly/CWCCommunity @AdrienVillez
Hey Chris! Can't really understand why you moved the var sum and print("") out of the loop in order for the numbers to add up? Like why does it not work inside the loop? THANKS
Great question! Like mentioned earlier in the video, everything that is written in the loop will "reboot" once the loop run again and all data will be lost. If you write a variable outside of the loop, you can use it inside it the loop, save a number in it and let the loop run again without loosing that precious data. It's like doing 1 + 2 + 3 + 4 + 5 but always remember the previous count or number while if it was inside the loop, you would do 1 >> erased >> +2 >> erased >> +3 >> erased >> +4 >>.... etc. Like if you were wiping clean a white board after every time you write something down. (Like how my kids behave! Once write something down, the other erase it.... drama!) @AdrienVillez
Hello! They're used to "contain" a block of code statements. Most commonly used to contain the code statements for a function or class (Lessons 6-7 of the beginner series).
Hi!Thank you very much for this videos,are very helpfull.I just wanna ask you .I saw that you have 2 posts,How to make an app and this one with swift.How I should watch both.In what order,so everything can make sense? Thanks again
This is still freaking tough to learn, is there an easier way to understand this? i can repeat this over and over but mayn lol this is a gift but thank you
Great ! I have one question: Why is it 15 in the end ? sum is 0 and index is 1 to 5. Then, in the loop, you declare that sum is actualy sum + index, which means 0 + 1 to 5, which is... 5 ? And if we repeat (or loop) that 5 times, we would get 25, no ? Little bit confused student
if you add 1 +2 = 3 3 + 3 = 6 6+ 4 = 10 10 + 5 = 15 you basically add all the numbers together from 1-5 if that makes sense! i was confused also at the beginning.
Picture the index to be like the number of floors in an elevator: 0, 1, 2, 3, 4, .... Once you are on the second floor, your check for index 2 and you can fetch the data! (I like the elevator analogy because index starts at 0, so that's like the main hall before the first floor, easy to make a mistake when you start to count 1, 2, 3, ...) Does it make more sense now? @AdrienVillez
QOTD ⚡Have you learned about loops in another programming language before? Let me know! 👇 Kick start your own app with my free 7 Day App Action Plan ➡️ bit.ly/7dplan
i can't believe how easy to understand the basics of swift 3 !!
thank you very much i really enjoy watching your videos ^^
This series is awesome! I already know C++ and Java, but skimming this video along with Chris' explanations helps me learn the syntax for Swift 3.1 faster. Subbed.
I appreciate that Gabriel! Thanks for watching with me!
i really appreciate your comforts man
i really need this to know how loops work in swift
best swift tutorial hands down! Much love, keep posting brother
Thank you for the support!!!!!!!!
@AdrienVillez
I am a 11 year old this taught me to code is amazing.
welp i definitely know your not lying about being 11
@@dagodian5365 ahaha dlajd s;lgasdfjdslghasldfja
Hi Chris, I was curious how you would be able to print the results of the for-in statement one by one. A good example I believe would be - when you level up a character its total damage increases by 2 each level. How would we print or insert that data?
Hello, inside the for loop it will go through the data inside "array" or range of values one by one
for something like stats you don't need a loop for that, maybe you can just simply access the data and multiply it by a base value (like 2)
- Francis
awesome chris! You have made it hell easy to understand for newbies ... thanks for the efforts
Glad to hear that Vikas, thanks for watching!
great series I know java and c# but swift is similar which is cool but how do you control the iterator in the for in loop for example lets say you wanted it to subtract instead of add would you have to put 1...-5?. I have never heard of a for in loop until today. Its amazing how swift knows what your implicit variables are but wont that get confusing as a code base grows maybe its just me and im used to explicity setting variables to types.
Hello at 9:18 how is the print out 15? Thanks in Advance Guys!
Hey Rubensito, each time it loops, it's adding the next number to the sum. So it's 1 + 2 + 3 + 4 + 5 and then it prints out the total after all the loops.
Rubensito Don’t feel bad I had to add the numbers myself
How do i accept an integer value from the user?
By the way great teaching methodology
Hello, again! I replied on you last comment (which was the first for me in my list of comments)
@AdrienVillez
What is the significance of using the word "index"?
Hey Trent, it's just a variable name and you can specify any name you'd like.
When you access that variable inside the loop, it gives you the number in your looping range that it is currently on.
So if I understand correctly, "for Index..." is the same as when we define variable with var index ?
I think it's
Hey chris I’m watching this video and when typing in my “sum+= index” i get a pop up that says it cannot concert value of type (unsafe pointer ) could you help me explain why I get this pop up and how I can fix it if it’s not too much of a hassle? Thanks chris love the videos !
That's weird, especially with something as basic as an addition. Did you let some space between sum and +. Sometimes sum+ and sum + can mean 2 different things.
I'm curious to see a screenshot of this, can you post it on our support page? bit.ly/CWCCommunity
@AdrienVillez
he teaches better than my teacher
Hey Chris! Can't really understand why you moved the var sum and print("") out of the loop in order for the numbers to add up? Like why does it not work inside the loop?
THANKS
Great question! Like mentioned earlier in the video, everything that is written in the loop will "reboot" once the loop run again and all data will be lost.
If you write a variable outside of the loop, you can use it inside it the loop, save a number in it and let the loop run again without loosing that precious data.
It's like doing 1 + 2 + 3 + 4 + 5 but always remember the previous count or number while if it was inside the loop, you would do 1 >> erased >> +2 >> erased >> +3 >> erased >> +4 >>.... etc. Like if you were wiping clean a white board after every time you write something down. (Like how my kids behave! Once write something down, the other erase it.... drama!)
@AdrienVillez
@@CodeWithChris Makes so much sense now. Thank you for the fast and easy response!
All the best
So, Chris, we talked before yes, but what do the {curly braces} mean?
Hello! They're used to "contain" a block of code statements. Most commonly used to contain the code statements for a function or class (Lessons 6-7 of the beginner series).
Hi!Thank you very much for this videos,are very helpfull.I just wanna ask you .I saw that you have 2 posts,How to make an app and this one with swift.How I should watch both.In what order,so everything can make sense?
Thanks again
From my own limited experience, I would say learn the code and syntax first, then learn how to make the app.
Exactly what I’m doing now....{
Know the code
Print(Soon you’ll be a CODER)
}👍
I've been meaning to ask, what's with the
on the right screen thingy if you 'print' something?
It's to get a
return to
the
next line
in the console
or in a label
if you do not
want all the text to be on the same
line.
-Adrien
thanks, lol.
This is still freaking tough to learn, is there an easier way to understand this? i can repeat this over and over but mayn lol this is a gift but thank you
Raden SoCal I felt like I was in Groundhog Day how I kept replaying the 7 minute mark(6times) till I got it lol
"immutable value 'index' was never used; consider replacing with '_' or removing it" --- What does that mean?
If a variable name is never used, Xcode proposes you to name as underscore.
how to print star pattern in swift pro
Great ! I have one question:
Why is it 15 in the end ? sum is 0 and index is 1 to 5. Then, in the loop, you declare that sum is actualy sum + index, which means 0 + 1 to 5, which is... 5 ? And if we repeat (or loop) that 5 times, we would get 25, no ?
Little bit confused student
Oh okay, i got it. It's actualy 1 + 2 + 3 + 4 + 5 = 15. Still not sure why it just adds up those numbers when we tell it that var sum = 0 + 1 to 5.
if you add
1 +2 = 3
3 + 3 = 6
6+ 4 = 10
10 + 5 = 15
you basically add all the numbers together from 1-5 if that makes sense! i was confused also at the beginning.
I am 11 and you helped me learn
Never too young, never too old! Find your passion and just become amazing at it!
@AdrienVillez
Excellent
Thank you....
Welcome! :-)
Darn, swift looks so interesting. I wish I could develop with it with windows. Guess I got to save up.
you can use mac by a Virtual machine "Vmware" on Windows
Try a Mac Mini, its the cheapest route if you already have a PC.
Few Minute Programming "buy" a virtual machine. That's what I did to get windows on my mac ;)
try hackintosh or VMware
Only if u wouldve explained what index was, i wouldnt be wondering it for the 11 minutes
Picture the index to be like the number of floors in an elevator: 0, 1, 2, 3, 4, ....
Once you are on the second floor, your check for index 2 and you can fetch the data!
(I like the elevator analogy because index starts at 0, so that's like the main hall before the first floor, easy to make a mistake when you start to count 1, 2, 3, ...)
Does it make more sense now?
@AdrienVillez
I wanted to be a computer scientist when I grow up
Let's go for it! You have all the tools at your disposal to even make apps right now! Don't wait!
@AdrienVillez
Didn’t understood
Please don’t use such heavy words
Or if you do please explain it before you use them
Thanks for the feedback! This is the more updated version of the Swift for Beginners series bit.ly/LearnSwift2019
-Kat
var sum = 0
sum body once told me the world is gonna roll me,
Good one!
-Adrien