From the course: Learning Julia

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Data type casting

Data type casting - Julia Tutorial

From the course: Learning Julia

Start my 1-month free trial

Data type casting

- [Instructor] Since Julia has the ability to assign types to pieces of data, sometimes the need will arise to have to convert or cast one type of data to another. So let's take a look at some examples of doing this. I'm going to open up my convert underscore start file, and I have some variables with different data types already defined. So let's start with a couple of simple examples. So first, I can use the character constructor to convert an integer number to a character. So I'm going c is equal to Char and I can give it a number like 74 and then I can print that out and I can also convert the other way, I can take a character value and convert it to an integer type. So I just simply use the Int converter and I'll convert the J character and let's print that out as well. All right so let's go ahead and save and let's run this. So let's go ahead and run Julia and let's convert start and you can see that when I convert 74 to a character, I get the J and then the J becomes the 74…

Contents