Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Finally, the course compares how code is written in several different languages, the libraries and frameworks that have grown around them, and the reasons to choose each one.
It understands these are numbers. It adds them together. If on the other hand, I create these variables with the digit 5, but inside double quotes as a string and then I use exactly the same code, I'm using the addition operator to add them together, what's going to happen is concatenation, not addition. They are going to put them beside each other and what will be output is 55. This is a behavior you do occasionally want to have happen even when the values in your strings are what we think of as numeric.
So you're working with area codes and phone numbers. You don't want to be in a situation where those will get added to each other and actually have a different number, you want them concatenated one beside the other. Now it might get a little more puzzling, but what happens if you've got one of each? So what happens if one variable is a number and the other variable is a string? Well, what's going to happen is if one is a string, that's going to take charge. You'll get concatenation will occur. Now where it can get even a bit more involved is what happens if you try and do something that just doesn't make sense.
Because sometimes we have variables that we want to be a number, but aren't. Let's say for example we've got a variable equal to the string 55, so it could be numeric, but it could be abc. It could be an exclamation mark. Perhaps we're asking somebody to type in a value into a prompt box. We hope it's a number, but it might not be. Well, what I can do first is I can create a new variable. I'll call it myNumber. I'm going to try and convert whatever is in foo into a number.
There are currently no FAQs about Foundations of Programming: Fundamentals.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.