ПочатиПочніть безкоштовно

Converting types

Integers, floats, and strings are the most common data types you will encounter when working with Julia. Certain operations can only be performed on certain data types, and some operations work differently based on the data type.

For example, in Julia 3*2 will return 6, but "3"*"2" will return "32". These kinds of bugs can crash your code or ruin your analysis, so it is important to know how to convert between types.

Ця вправа є частиною курсу

Introduction to Julia

Переглянути курс

Інтерактивна практична вправа

Спробуйте виконати цю вправу, доповнивши цей зразок коду.

a_float = 3.0

# Convert a_float to be an integer and print its new type
a_int = ____(____)

println(____(____))
Редагувати та запускати код