Programming Basics: Statements & Functions: Crash Course Computer Science #12

  Рет қаралды 941,390

CrashCourse

CrashCourse

Күн бұрын

Пікірлер: 551
@crashcourse
@crashcourse 7 жыл бұрын
Hey guys! The fine folks at Thought Café brought our Grace Hopper game to life! Check it out here thoughtcafe.ca/hopper/ and tell us your best score! - brandon (366)
@joshuamartin3881
@joshuamartin3881 7 жыл бұрын
Im actually in the building Grace Hopper worked in. The museum is pretty cool.
@Michalog2
@Michalog2 7 жыл бұрын
LEVEL:10; SCORE:1776 and 3 working relays after Game Over xD
@deenmhmd
@deenmhmd 7 жыл бұрын
Great job Thought Cafe
@avi8aviate
@avi8aviate 6 жыл бұрын
Score of 152. Don't really think I did all that well.
@firenationfiles2063
@firenationfiles2063 6 жыл бұрын
*Superhero Café*
@armorsmith43
@armorsmith43 7 жыл бұрын
Tip from a software engineer in the industry: The names you choose for functions and variables have a *huge* impact on how good you're going to be at completing projects. Why? It lets you read, understand, and check your code much more efficiently and surely.
@armorsmith43
@armorsmith43 7 жыл бұрын
> statements like "I want tea" or "It is raining" Hello from the UK.
@gustavolrcoelho
@gustavolrcoelho 7 жыл бұрын
She also said she wants a unicorn. So there's where they all went then.
@Biscuitsdefortune
@Biscuitsdefortune 7 жыл бұрын
True fact: The unicorns are all in Scotland.
@jacoblevine1877
@jacoblevine1877 7 жыл бұрын
I applaud you, crash course. It must have taken a soul crushing level of work to make this complicated mess into something that made sense to me. This series is brilliant.
@ProfessorT_
@ProfessorT_ 7 жыл бұрын
Is it just me or is it really satisfying when there's a new level of abstraction?
@Jianju69
@Jianju69 5 жыл бұрын
It is often a good thing, yet at times we are sacrificing efficiency at the same time.
@uzairakram899
@uzairakram899 5 жыл бұрын
No, I hate that music they should discontinue it.
@philosophyofpolitics4504
@philosophyofpolitics4504 5 жыл бұрын
For me it's the opposite reaction, like, "Oh shoot! Now we're entering into another dimension... How many of these dimensions do I need to understand? My head will explode!"
@YeoYeo
@YeoYeo 7 жыл бұрын
I need to point this out because I know that beginners always get confused by this: *The equals sign does not mean equals!* It means: put the thing on the right into the thing on the left. So in this example (1:18) as stated it means "Put 5 in A." It's much easier to understand when you don't think of the equals sign as equals. The video is still excellent! Looking forward to more programming vids :D
@isaacsteele7986
@isaacsteele7986 7 жыл бұрын
Pikalolz i like to think of equals as a function. divide one side into the other. if the result is one, than equals is true
@randomdogdog
@randomdogdog 7 жыл бұрын
I am surprised that they are using = and presumably ==
@mxg75
@mxg75 7 жыл бұрын
For this kind of psudeocode, I'd almost dig up the old "SET x=42" syntax of old-school BASIC.
@RaymondHng
@RaymondHng 7 жыл бұрын
In other words, in BASIC: A = 5 X = X + 1 C = A - B would be equivalent in COBOL: MOVE 5 to A. ADD 1 to X. SUBTRACT B FROM A GIVING C.
@oo0O08
@oo0O08 7 жыл бұрын
I tend to think this is a good way of illustrating it to beginners: A
@TehBurek
@TehBurek 7 жыл бұрын
I love the series, and I feel a bit bad and spoiled for wanting to complain, but this might have been a bit too fast to follow. I've been a programmer for many years, and I am feeling sleepy at the moment, but I found this episode required more effort to follow along than I expected. I like the idea of a game where Amazing Grace squashes bugs, but it might not have been the best example. This way, you need to understand the game itself (which was presented in a very abstract and loosely defined way) AND understand the programming constructs themselves. It might have worked better with an example that didn't need explanation by itself, something that most of the audience would've been already very familiar with, video game or otherwise. Just felt a bit clumsy to me (but with the best intentions, I recognize that). Those were my two cents, thank you for your attention.
@drop2001
@drop2001 7 жыл бұрын
I want to say THANK YOU, this is better than what many CS professor teach in stupid programming courses in university.
@syk13
@syk13 7 жыл бұрын
Thanks Carrie Anne and Crash Course, this series is excellent and you are all doing a phenomenal job.
@iAMwReckLesss
@iAMwReckLesss 7 жыл бұрын
I thought for British people it was more like while True: get_tea()
@sixestla8878
@sixestla8878 6 жыл бұрын
More like: World.startRain(); while (true) { for (Person p : this.living) p.drinkTea(); } World.stopRain(); // note: this will never happen.
@cometobrazil9916
@cometobrazil9916 5 жыл бұрын
10 GET_TEA 20 GOTO 10
@billniko9310
@billniko9310 4 жыл бұрын
while tired { GetTea() }
@MC-Minority
@MC-Minority 4 жыл бұрын
@@sixestla8878 Jesus Christ, did you just use a range loop? 😂
@toxicnatedog8952
@toxicnatedog8952 4 жыл бұрын
Racism
@Danielevans2
@Danielevans2 7 жыл бұрын
THIS SERIES IS ONE OF THE HIGHLIGHTS OF MY WEEK
@cknife
@cknife 7 жыл бұрын
This really reminds me of my computer science degree --- examples in all the languages except the ones I wanted to learn!
@mau345
@mau345 4 жыл бұрын
Before I always avoided computer science topics. I always felt overwhelmed even though I belong to the hard sciences. Didn't bother me, I mean, my career should be totally independent from this. But lately at work, I'm dealing with so much data gathering and excel won't cut out--it's an inefficient nightmare. After that, I just knew I had to do something. I'm so happy to at least consider making myself literate and in this journey, this crash course series has been so enjoyable, my younger self would be so surprised. Kudos to you miss and your whole team. The effect is surely exponential. To be honest, i think that education for computer literacy should be as important and free as reading and writing in the future.
@i-zeekIndeedy
@i-zeekIndeedy 5 жыл бұрын
You're honestly a great teacher
@GarrettBSettles
@GarrettBSettles 7 жыл бұрын
this is excellent- I've been dabbling in program just shy of a year, and this perfectly encapsulates functions in a succinct and brilliant manner- thank you :)
@dawntraci
@dawntraci 7 жыл бұрын
Someone please tell Carrie Anne I love her!! I have been trying to figure out functions and if/else statement for a week!!! The dots FINALLY connected!!! Crash Course it the bizness!!
@lozD83
@lozD83 4 жыл бұрын
This series is exactly how programming should be introduced to kids (or anyone for that matter) 👍
@andysartz
@andysartz 7 жыл бұрын
Loving this series! You're making me want to become a programmer!
@wanderingrandomer
@wanderingrandomer 7 жыл бұрын
This is great! I've been trying to learn how code games in C++ for the past 2 years at college, and I just do not get it. This video has explained some basic stuff to me in a way that actually makes some sense!
@Theorak
@Theorak 7 жыл бұрын
7:59 PFUDOR! Love it.
@92alexmaster
@92alexmaster 7 жыл бұрын
YAY FLUFFLE PUFF!!!
@miko5322
@miko5322 4 жыл бұрын
FLUFFLE PUFF!!!! i noticed as well i was like wait a minute
@adelarscheidt
@adelarscheidt 7 жыл бұрын
Carrie Anne my wayward son
@mugdhapeter
@mugdhapeter 7 жыл бұрын
:"D OMG!!
@loganingram9397
@loganingram9397 5 жыл бұрын
There'll be peace when you are done.
@JDunk302
@JDunk302 5 жыл бұрын
Lay your weary head to rest
@zgriffinwonderland5707
@zgriffinwonderland5707 4 жыл бұрын
@@JDunk302Don't you cry no more *epic guitar solo*
@JDunk302
@JDunk302 4 жыл бұрын
@@zgriffinwonderland5707 Hell yeah brother
@ekings2119
@ekings2119 4 жыл бұрын
The first 11 episodes were full of completely new knowledge for me, but I already knew everything in this one, as I've been programming for a while... what a good showcase for the power of abstraction. ;-)
@renlin6614
@renlin6614 7 жыл бұрын
I lost tons of points in my AP Computer Science Exam for using bushDid911 or drinkBleach as a boolean, using theFucksIGive for an integer and using battleship names for my doubles... the teacher was not pleased... but seriously... boolean bushDid911 = true;
@sponge1234ify
@sponge1234ify 7 жыл бұрын
Unless theFucksIGive is a constant, it will rarely, if ever, stay at 0. Which it should've.
@renlin6614
@renlin6614 7 жыл бұрын
Sadly, I care too much about things...
@luqcrusher
@luqcrusher 7 жыл бұрын
HAHAHHAHA
@XamiNaxamis
@XamiNaxamis 7 жыл бұрын
I thank the lord every day that my teacher is willing to look past my usage of shitty memes as variable and constant names... I would've failed like half of my assignments if he didn't :U
@thegaspatthegateway
@thegaspatthegateway 6 жыл бұрын
I think you scored points where it really matters - in our hearts
@skatf
@skatf 5 жыл бұрын
This has helped me break down coding to a basic level which I desperately needed! Thank you so much.
@dg-hughes
@dg-hughes 5 жыл бұрын
7:33 I have to say the level of abstraction images shown in the series CS videos are amazing, from physical to two different logical diagrams, even the music changes. To the crew who designed that I say well done! I've tried to make my fair share of logical diagrams and it can be quite difficult.
@ShaunDreclin
@ShaunDreclin 7 жыл бұрын
This should be a daily show T.T
@tartanhandbag
@tartanhandbag 7 жыл бұрын
yeah, i had the same thought. like, i wish TV was at this level where i could sit back with a cup of tea and flick through the channels and find stuff like this. then i might actually watch TV...
@dg-hughes
@dg-hughes 5 жыл бұрын
5:03 I've found in computer science there are many times when reading from right to left makes more sense. I'm a mediocre "programmer" (I dare to use that word) at my absolute best but the reading right to left trick I eventually discovered late in life helps me quite a bit.
@andobando4873
@andobando4873 7 жыл бұрын
This took a very imperative view of programming. I would like functional programming to be mentioned aswell.
@gosnooky
@gosnooky 7 жыл бұрын
Ando Bando and OOP
@poppop-oj6by
@poppop-oj6by 7 жыл бұрын
Ando Bando I would like it if they mention it but I don't think it is that sicnificant. If this episode is all we get to see about programming rules then there is no room for functional languages. We just got to know what a function is. Explaining the lazy character of haskell would take to much time.
@andobando4873
@andobando4873 7 жыл бұрын
pop pop I realize that explaining many parts would be difficult and arguably not necessary for such an introductory course. I just think it ought to be clear to beginners that there isn't just 1 way to think about these things.
@poppop-oj6by
@poppop-oj6by 7 жыл бұрын
Ando Bando I agree. They should at least mention the other way so people can look it up for themselves.
@BosonCollider
@BosonCollider 7 жыл бұрын
I think it could work in the episode on algorithms, since she'll probably have to talk about recursion. But to do that properly, you really need to mention the call stack, and we just covered what a function is.
@chipio
@chipio 7 жыл бұрын
You can also call a function inside of itself! -------------------- function recursiveThing(number) if number
@sixestla8878
@sixestla8878 6 жыл бұрын
Here is a pseudo-code example in Lua 5.1 for searching directories and subdirectories, while using the recursion principle: function searchDirectories(path, _files) if (!filesystem.isDirectory(path)) return path; end local files = _files or {}; for _, file in pairs(filesystem.getFileList(path)) do local fPath = path + "/" + file; if (filesystem.isDirectory(fPath)) searchDirectories(fPath, files); else table.insert(files, fPath); end end return files; end
@christacollins8809
@christacollins8809 7 жыл бұрын
Yayyy!!!!! I cannot wait for next week. I have never written an algorithm before! Thank you CC Computer Science and Carrie Anne!
@subrisubrika5652
@subrisubrika5652 7 жыл бұрын
that's about as much about programming I know! can't wait for future episodes!!!
@CaddyWhumpusGamer
@CaddyWhumpusGamer 5 жыл бұрын
I have wanted to get into programming for awhile now and found this video. It is by far the best I have found. I am looking forward to watching many more Like this one. Liked and subbed. keep up the good work.
@Travisharger
@Travisharger 7 жыл бұрын
This is one of the best courses yet.
@mikejohnstonbob935
@mikejohnstonbob935 7 жыл бұрын
Boil water, add noodles, wait 10 minutes, drain and enjoy Unfortunately, due to short circuiting, once drain evaluates to false, enjoy is never evaluated => No joy to be had for non-drained food :(
@JasonHise64
@JasonHise64 7 жыл бұрын
Well, that is a recipe for spaghetti code. With the 10 minute wait the OS might decide your program has stopped responding, and before anything is drained everything might just go out of the windows entirely.
@MrDylan2125
@MrDylan2125 7 жыл бұрын
Functions are my favorite. Allowed me to take a code I inherited at work and condense it to about half the size. Makes debugging infinitely easier.
@victorvytb
@victorvytb 9 ай бұрын
this is so much better in 0.75 velocity! Thanks for the course, its magnific!
@Thomahawk1234
@Thomahawk1234 7 жыл бұрын
I already liked the last episode, but this one was even more interesting! You do talk a little fast so some parts were a bit hard to follow. Good thing there's the option to rewind. Keep em coming!
@dementedsnake
@dementedsnake 7 жыл бұрын
Carrie Anne is a good presenter. I find myself forgetting to take notes as I instead get lost watching and listening to her teach.
@smudgepost
@smudgepost 5 жыл бұрын
Love all CC videos thank you. In my opinion I do think the definitions are a bit rushed and it may be difficult for a new coder to watch this video and then explain what a function is. I'd describe a function as a nested block of code that performs some logic and can be called repeatedly at other points. This saves a coder from retyping those rules over and over again and they can simply reference the function they created.
@gracezhao3168
@gracezhao3168 5 жыл бұрын
Couldn't give you enough like!!!! Your video is extremely helpfu!!
@billniko9310
@billniko9310 4 жыл бұрын
thanks for your series that most clearly describe about programming I found
@MatrixCL
@MatrixCL 7 жыл бұрын
Those function libraries that Carrie Anne mentions in the end are .dll files in Windows. Basically a piece of (legacy) code that a programme uses. Just mentioning it in case you ever wondered what those .dll files are for. :-)
@badjuju4393
@badjuju4393 4 жыл бұрын
Thank you for this wonderful succinct yet illuminating explanation!
@tcphd2506
@tcphd2506 7 жыл бұрын
thank gosh I played around with codecademy, I actually understood all of those explanation on the first go without having to stop and playback the video
@joshuaheathcote2116
@joshuaheathcote2116 4 жыл бұрын
Pretty sure this is the female version of David Mitchell. Clearly the best series ever created on comp sci and should be shown in all schools. No other material out there compares to this when it comes to learning.
@Huntracony
@Huntracony 7 жыл бұрын
It's fairly common for me at least to remake an already existing function in a library somewhere either because it provides too little functionality for my purposes or too much. For example I made something which required me to calculate powers of 2 a lot of times per frame (I can't for the life of me remember why), and for some reason the standard library function was incredibly slow, so I just made this function below (javascript) and it drastically increased the performance of whatever I was making. function Pow2(n){ var Result=1; while(n--) Result += Result; return Result; }
@IceMetalPunk
@IceMetalPunk 7 жыл бұрын
It's always nice to watch a well-made review of my field :)
@RitobanRoyChowdhury
@RitobanRoyChowdhury 7 жыл бұрын
Are you going to cover data structures? HashSets, Queues, Dictionaries, Lists, Arrays, Heaps, Red-Black/Binary Trees, etc?
@pinklady7184
@pinklady7184 7 жыл бұрын
If I am tired, then I go to bed. Else, I stay up late to watch this video. Gr8 video. 👍👍👍👍
@zubmit700
@zubmit700 7 жыл бұрын
Love your series.
@ladydarkangelyuki
@ladydarkangelyuki 7 жыл бұрын
My favorite type of function is recursive function, to understand recursive function we must first talk about my favorite type of function is recursive function, to understand recursive function we must first talk about my favorite type of function is recursive function, at this point you should understand what a recursive function is, it is a function that calls it self usually until a statement is false, the utility in recursion in opposition to a loop is that you can keep track of transformed data more efficiently then a loop, say you write a pathing function to have something at point A find the shortest path to point B you could recursively send yourself in every direction and return the instruction for the shortest path, although more polish would be coded such as estimating the shortest path to begin with and then circumventing obstacles recursion helps keep track of the data better then a loop would.
@moosword5322
@moosword5322 4 жыл бұрын
Great teaching! Thanks for the video
@keerokamiya9126
@keerokamiya9126 7 жыл бұрын
I love coding it's like being master of your own little universe lol Just wish I were better at it
@billniko9310
@billniko9310 4 жыл бұрын
a = 5 "a" is variable name "5" is variable value "=" is assignment that assign variable value to variable name to create variable symbol,or assign any to any. you can use any symbol to represent any thing or symbol
@Napoleonic_S
@Napoleonic_S 6 жыл бұрын
What I want to know is how exactly does high level programming looks like from low level and pure physics point of view? Explain to me how does A=1 B=1 C=A+B Exactly looks like in the logic gates and micro architecture? And how does it look like in physical view? I mean like electrical energy goes from where to where inside the transistors and such.
@bobbobety
@bobbobety 5 жыл бұрын
Exactly what I also want to know!
@kennymartin5976
@kennymartin5976 7 жыл бұрын
Oh hey, Fluffle Puff! I did not expect to see her here.
@charlesrosenbauer3135
@charlesrosenbauer3135 7 жыл бұрын
With how much it is influencing parallel software, and how much it is focused on in academia, I think a discussion of functional programming is important in any modern general computer science course.
@orekihoutarou6107
@orekihoutarou6107 7 жыл бұрын
Charles Rosenbauer "Any" So an advanced course in Robotics with prerequisite courses such as C++ and C# should discuss functions?
@charlesrosenbauer3135
@charlesrosenbauer3135 7 жыл бұрын
By "computer science courses" I meant general computer science (for example the subject of this video series), not a more specific sub-field. Thanks for pointing that out. My comment was a bit ambiguous. Also, a lot of features of functional programming are making their way into C++. That's where lambda expressions and promises are from. And the subject of "functions" is a very different subject from "functional programming."
@EspenAleksLarsen
@EspenAleksLarsen 6 жыл бұрын
This series is amazing. Thank you so much.
@jackisgoofingoff5510
@jackisgoofingoff5510 2 жыл бұрын
Even I have certain coding experience, this video is still useful
@ThorOdinson2
@ThorOdinson2 7 жыл бұрын
Actually, the correct linguistic terminology for why we can't say "I want raining" is MORPHOsyntax. Computer languages may refer to it as just "syntax", but for human languages it is morphosyntax.
@cash4laughs71
@cash4laughs71 6 жыл бұрын
indeed im intrigued to hear you explain code recipes
@AmanSingh-cb7om
@AmanSingh-cb7om 6 жыл бұрын
Very nicely explained, thank u.
@Cuzco08
@Cuzco08 7 жыл бұрын
Are they ever going to cover the execution of the programs? How or what is executing the code, physically?
@verdatum
@verdatum 7 жыл бұрын
"In modern programming it's uncommon to see functions longer than around 100 lines of code" *Deep breath* HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA God, I wish. I love you guys.
@sponge1234ify
@sponge1234ify 7 жыл бұрын
_Functions_, not _programs_. Granted, that doesn't make the statement technically _true_ either, but a function that long would really hurts readability
@neutronstar6739
@neutronstar6739 7 жыл бұрын
ikr, my function is longer than 1000 line of code.
@Deveyus
@Deveyus 7 жыл бұрын
A) That sounds very CinemaSins B) If your functions are that long, and your code review partner is letting you get away with that, you have other problems.
@verdatum
@verdatum 7 жыл бұрын
Deveyus, 2 words: "Legacy code".
@sponge1234ify
@sponge1234ify 7 жыл бұрын
Code Partner? who's that? _sniff_
@noxabellus
@noxabellus 7 жыл бұрын
With everybody yelling about their pet area of CS not getting adequate coverage...While I'm not personally dissatisfied with the information provided thus far, I am wondering how many episodes we can expect and anxious to see what will be covered.
@void2258
@void2258 7 жыл бұрын
What about objects? How about functional programming? Also, are we going to go back and deal with the compiled vs interpreted confusion from earlier?
@Marcos-qv3mz
@Marcos-qv3mz 7 жыл бұрын
great video!! Keep doing stuff like this!. Thank you very much!!
@orwell_fan
@orwell_fan 5 жыл бұрын
"Adding numbers is boring, let's make Video Games instead". Totally love this course!
@lostincyberspaceIII
@lostincyberspaceIII 7 жыл бұрын
I love the Andre and the Crash course games reference!
@betsy.-val
@betsy.-val 7 жыл бұрын
i spent my morning trying to figure out how to do stuff in MATLAB, and I randomly found this. I feel so understood now 😜
@wanderingursa8184
@wanderingursa8184 7 жыл бұрын
... I remember that happy unicorn! That's Fluffle Puff!
@starlightbright
@starlightbright 7 жыл бұрын
Another sleepless night with Carrie Anne. And now that pasta sequence made me hungry...
@toreinimene1071
@toreinimene1071 7 жыл бұрын
Superawesome series, CC!
@hmhmhm7805
@hmhmhm7805 7 жыл бұрын
I just got a degree in Computer Science. Glad to answer any questions for anyone curious about the degree or general programming.
@andrewmoore4429
@andrewmoore4429 7 жыл бұрын
If homework =1 Binge KZbin videos
@WiseWik
@WiseWik 7 жыл бұрын
else Binge KZbin videos
@LeoMRogers
@LeoMRogers 7 жыл бұрын
syntax error. assignment in if statement.
@oli2.019
@oli2.019 7 жыл бұрын
You mean if homework > 0. Or else you couldn't binge watch if you had 2 homework assignments or you could just use true or false.
@randomdogdog
@randomdogdog 7 жыл бұрын
when I was learning puesdo code, we used
@RosesAndIvy
@RosesAndIvy 7 жыл бұрын
Whether or not it's a syntax error depends entirely on the language.
@billniko9310
@billniko9310 4 жыл бұрын
a function equals to a conditional abstracted variable symbol that hidden procedural program sort of as a word hidden definition.we call you create a function successfully by package program into a function as define function. it will receives value gives to specific named variable from where calls it then processes,gets the result variable value and returns the result value to function,but send value into function and function returns value isn't always an absolutely necessary needed for every function.
@tahaanouar2453
@tahaanouar2453 4 жыл бұрын
Love you Crashcourse ❤️
@Roxor128
@Roxor128 7 жыл бұрын
Algorithms next week? I fully expect the obligatory recursive definition of recursion when the subject of recursion is raised.
@abbasfadhil7826
@abbasfadhil7826 4 жыл бұрын
things are getting easier
@mbm3155
@mbm3155 6 жыл бұрын
This was a much wanted series :-); i havent the attention span to star at this on paper
@Candlewaxeater
@Candlewaxeater 4 жыл бұрын
i would like to say something about 3:36 an if statement does not use English to work. i think she meant the if statement as this if (energy < 20) { tea = true ) or if you wanted something else to happen when tea = false you could use an else statement which does not have a true or false condition instead it goes like this if (energy < 20) {tea = true} else {water = true}
@anthonymorford8804
@anthonymorford8804 6 жыл бұрын
I'm glad this was fun
@Biscuitsdefortune
@Biscuitsdefortune 7 жыл бұрын
I use to programme in Visual Basic at secondary school, good code to learn how to code.
@DjangoLowe
@DjangoLowe 7 жыл бұрын
I love this show!!!
@chrissanders4449
@chrissanders4449 5 жыл бұрын
i wish i saw this video two years ago.....a lot of things would have made so much more sense lol i loved it
@billniko9310
@billniko9310 4 жыл бұрын
thanks for your words about programming, if you do some lecture about computation theory the mother theory to mental,psychology,computer,programming,artificial intelligence and etc it will be more much better.
@unpronouncable2442
@unpronouncable2442 7 жыл бұрын
Pink fluffy unicorns dancing on rainbows.
@Tuckems
@Tuckems 6 жыл бұрын
Unpronouncable no
@yipinglim9114
@yipinglim9114 6 жыл бұрын
Andrew Huang is my favourite Pokémon
@derron5623
@derron5623 6 жыл бұрын
can you get me some breakfast?
@deathrider535
@deathrider535 6 жыл бұрын
how would you describe the texture of their magical fur? "smiles"
@elonmusk5689
@elonmusk5689 6 жыл бұрын
Great explanations!
@Huntracony
@Huntracony 7 жыл бұрын
Don't kid yourself, for loops are exactly the same as while loops (with a few exceptions like python). In many programming languages for loops look something like this: for( statement0; expression; statement1 ) { DoSomething(); } It'll execute statement0 once at the start, and for every loop check if the expression is true (if not exit the loop), do the thing in the loop and execute statement1. This is exactly the same as the following: statement0; while( expression ) { DoSomething(); statement1; } The only reason to use one above the other is clarity, but they're not actually different.
@poppop-oj6by
@poppop-oj6by 7 жыл бұрын
Huntracony That is not true. You use a while if you do not know when the loop is going to end. The loop doesn't always have an upper bound of the amount of iterations it will take to compleet.
@Huntracony
@Huntracony 7 жыл бұрын
pop pop, It is true, go test it if you like. It is common practice to use them in the way you describe, but you do not have to. I actually quite like doing things like: i=5; while( i-- ) { DoSomething(); } and I never use for loops outside of python where they act like ForEach loops.
@poppop-oj6by
@poppop-oj6by 7 жыл бұрын
Huntracony Sure you can use a while like a for. But can you use a for like a while? yes but it is just dirty dirty. If I would find this in code I would slap my head on my desk. Yes a loop is a loop. But a for and a while are defined to be used differently. That is what makes them different. You can use a try-catch statement as an if statement. That doesn't mean you should.
@jecelassumpcaojr890
@jecelassumpcaojr890 7 жыл бұрын
By "real programming languages" you mean C and its variations? Other languages do it differently. The example language in the video was very Basic-like, for example.
@Dayanto
@Dayanto 7 жыл бұрын
You're very close, but you forgot one important difference. Unlike while loops, for loops also keep the variable(s) inside the loop's scope, which both frees up the variable names for reuse later on (so that you don't need to come up with new names for each loop), and makes sure that old loop variables can't be used somewhere else by mistake. Example: int i = 0; while (i < 10){ print (i); i++; } int j = 0; while (j < 10){ // Bug! This is actually an infinite loop since j never increases. With for-loops, this can't happen. print (i); i++; } To make them the same, you would also have to wrap the while loop in curly brackets, like this: { statement0; while( expression ) { DoSomething(); statement1; } }
@minghowlogic6223
@minghowlogic6223 7 жыл бұрын
cool, well explained!
@litenantjv
@litenantjv 7 жыл бұрын
Just a question (i'm a little bit rusty in programming) but Before introducing a functionception shouldn't be introduced the concept of class and inheritance?
@rogersnick17
@rogersnick17 7 жыл бұрын
GOD I love this series!
@FalbertForester
@FalbertForester 7 жыл бұрын
Ahhh! Another cliff-hanger! Mentioning algorithms and then leaving us hanging! Good episode, though.
@rickkwitkoski1976
@rickkwitkoski1976 7 жыл бұрын
WOW! If I didn't already understand this and have many years experience doing just this, I think that this episode would be very confusing.
@weston8400
@weston8400 7 жыл бұрын
python3.5 code 1 from secrets import randbelow 2 3 var = randbelow(10) 4 5 if var >= 6: 6 print("var is greater than 5") 7 else: 8 print("var is less than or equal to 5") 9
@ScottKorin
@ScottKorin 7 жыл бұрын
Ok, I'm I only 4 minutes into the video so I'm not sure what's next week, but by using the "let's make a game" sample, it's going to be an easy step into object oriented programming next week.
@pinklady7184
@pinklady7184 7 жыл бұрын
Carrie, if you speak quickly, it means your brain works at faster speed than average. I envy your brains.
@lydiapooley7234
@lydiapooley7234 5 жыл бұрын
THIS IS SOOOO FUN!!!!
@chalicefuse881
@chalicefuse881 7 жыл бұрын
Reminds me of Mathlab in college, the memories!
@basantgarg6729
@basantgarg6729 7 жыл бұрын
Very useful.
Intro to Algorithms: Crash Course Computer Science #13
11:44
CrashCourse
Рет қаралды 1,7 МЛН
Running "Hello World!" in 10 FORBIDDEN Programming Languages
18:07
小天使和小丑太会演了!#小丑#天使#家庭#搞笑
00:25
家庭搞笑日记
Рет қаралды 57 МЛН
Я сделала самое маленькое в мире мороженое!
00:43
Кушать Хочу
Рет қаралды 4,3 МЛН
Когда отец одевает ребёнка @JaySharon
00:16
История одного вокалиста
Рет қаралды 13 МЛН
Computer Scientist Answers Computer Questions From Twitter
14:27
Coding Was Hard Until I Learned THESE 5 Things!
7:40
Pooja Dutt
Рет қаралды 1,1 МЛН
100+ Computer Science Concepts Explained
13:08
Fireship
Рет қаралды 2,6 МЛН
COMPUTER SCIENCE explained in 17 Minutes
16:49
Wacky Science
Рет қаралды 1,3 МЛН
Quest To Find The Largest Number
11:43
CodeParade
Рет қаралды 505 М.
Operating Systems: Crash Course Computer Science #18
13:36
CrashCourse
Рет қаралды 1,5 МЛН
The First Programming Languages: Crash Course Computer Science #11
11:52
The Oldest Unsolved Problem in Math
31:33
Veritasium
Рет қаралды 11 МЛН