- [Instructor] The name of this video is "Data Types." So in the lesson on variables, I did go into and touch on data types, and some data types that we'll be using, and data types that are really common in a lot of programming, not just Python programming. So things like integers, floats which are real numbers, strings which are character-based Booleans, which are true-false statements. I talked a little bit about conditions around those and how we use them. And so I created this code where some of these things are coming in through inputs. They don't always have to come in through inputs. They could be written directly in the code like the string or the Booleans. And there's a couple other types that I didn't go into in the lesson that are unique to working with Rhino script. So what I'm gonna do is I'll run this. And so up at the top of the command line, right? It's asking me to put in an integer. I'll just hit Enter to input the default that's listed there. And select a box, I click on that poly surface. Select a curve, select that, select a surface, click on that, and then select a point. Okay, and it prints those things out. So in my output, I've printed out all those variables, and it prints everything out. And it's printing out the integers, the numbers, that string that I wrote one of the Booleans. At the bottom, the only thing that might seem strange here is in this variable called Point. I input a point, and it's outputting actually three things that are separated by commas. And that's the X, Y, Z values of that point. So that's what it took as the input. Now I've given these things names that try to suggest what they're holding. Maybe the only one here I would edit would be X 'cause I'm not really sure what type X is. So I might add I-N-T to the beginning of that, and let's say change that to a capital X. So it's telling me it's probably holding an integer, and then that's something to do with an X value maybe that I use the code. So if we run this again. Input an integer, five, yes, input number. Select a box, select a curve. Select a surface, and then select a point. So it's throwing an error which I saw in the last same error, which is a very common first programmer error. So name X is not defined. And then it's telling me the traceback line 26. So I go down to line 26, I see it's printing X. So then I remembered oh, I changed... Right, my variable up here from X to intX. So I need to make sure that's going to be the same everywhere in the code. So I just need to input that there, and that should work fine. So even though the names of the variable suggest what they might be holding, I don't actually really know if what is in bln01 is actually a Boolean-type data type or not. I don't know if intX is actually a Boolean data type or not. I mean, I could print them out which I've I've done and then look at them to analyze them. But it might actually not give me the full information that I need in terms of determining its type. Now, why I would want to find out its type? Well, we're going to find it's useful later because when you're trying to run a code, and debugging, and you're getting errors, maybe you're giving some function the wrong type of data. It's asking for a particular type of data, and it's saying you're giving it the wrong thing. So you might need to hunt that- To hunt that down you might need to figure out well, what type of data is being held in there? So I could take this print statement and just copy all these lines. Instead of printing out the variable, I'm gonna add a little line of code. We'll add a function called Type which is a Python function which I talked about in the lesson. And we can just paste that in front of all of these. Then, we can just go right down the row here. Cut, paste them. Okay, now what we're doing with this is we're not printing out what the variable's holding up here, but we're printing out the type of data that that variable is holding. So all this function does is it asks... It looks inside the variable that I have between the parentheses here in it, and it tells me, it's gonna tell me- Well, because I'm printing it out, it's gonna show me what the type of data is. So let's do that. We'll run this again, input integer, five. Let's input number. Hit Enter, select a box, so select that box. I'll select this curve over here. Select the surface I've drawn in the middle, and select that point. And so now it comes back, and it's printing out a whole bunch of data. So it's still printing out all my... What's held all the data that's held in my variables, and now it's telling me the type. So it's telling me indeed the first one's holding an integer, the next one is holding a float. That's S-T-R for string, B-O-O-L for Bool. And now I have... But then I have three things called G-U-I-D in a row. And then I have something called a 3D point. So these I didn't see in the lesson, and these are ones that are unique to Rhino script. So with these three under the GUID, and we we've talked about this before, when I get an object, a piece of geometry, what it's bringing in is the actual ID. That is a particular data type. When I bring in a point, these three values, XYZ, when I select that point in space, it sees it as a particular data type called Point3D. So and we might along the way get introduced to other data types. These are the main ones that we're going to to look at. Particularly important will be the GUID. We'll get this a lot in errors. Something we'll be asking for a GUID, and we're not giving it that. We're giving it something else. So you will see that type come up a lot. I guess lastly here, one of the things I want to make clear is that these variables could be anything, that again there's nothing structural or functional in the fact that I'm calling this strVal, that it's holding a string in it. So I could... This could hold an integer. It's going to work just fine. The Boolean could hold... Actually, let's go back here. Let's cut and paste this. I put that here, and I can put a five there. We could change the name. We could say imnotacurve. As long as that's repeated exactly as I wrote it, and it doesn't have any spaces in it, or start with a number, or have any funky characters. We just have to make sure we place it everywhere. There's also nothing in these messages that I have within these functions that makes it... That affects its operation. So I could say, select a dog. This could be... Input a cat And everything should probably work just fine. Run it one more time. Input integer, five, yes, input a cat. Select a box, select a curve, select a dog. I know I need to select the surface, so select the point. I'm not getting an error, everything's running fine. So this does tell me that now that bln01 is now a string, and strVal is now an integer, right? So the data types don't lie. They know what is being held in there. So one last thing here is I did talk a bit in the lesson about strings. So strings are these characters, right, like texts. They're either between single quotes or double quotes, it doesn't matter. They're gonna work the same, they turn red when I put the text. They can also include numbers which I talked about in the lesson. As opposed to maybe some other scripting courses that you might take which they might deal with strings quite a bit because they might be parsing large bits of text data. In this course, we actually don't work with strings that much. We will use them.... We use them more in instances like this where we're using them as a kind of message within a function. That might be one way we use them. Another way we use them is we might... Let's say in a print function, I could write- Maybe I wanted to... 'Cause here, I don't know what they're... When this prints out down at the bottom down here, I don't know what variable it's talking about. So maybe I take that variable name. If we just do it with point here. I paste it in here, and I got to make it a... Make it into a string by putting it in between quotes and then put a comma to separate it from the type. It's going to tell- It's gonna print out point, and then it's gonna tell me what type the point is all in one line, so we'll just... To end this, we'll see how that runs. So I'll run this again. Integer, input a cat. Select a box, select a curve, select a dog, and select a point. So now down at the bottom, it's printing out point. So it's telling me the variable name because I put it in here, and then it's telling me the type of data that's being held in that variable called Point. So that's another way we would use string. We might do cat... The catenation that I showed in the lesson. But generally we're using it in those ways as either messages or to label something in this course.