Book Image

Getting Started with Julia

By : Ivo Balbaert
Book Image

Getting Started with Julia

By: Ivo Balbaert

Overview of this book

Table of Contents (19 chapters)
Getting Started with Julia
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The Rationale for Julia
Index

Variables, naming conventions, and comments


Data is stored in values such as 1, 3.14, "Julia", and every value has a type, for example, the type of 3.14 is Float64. Some other examples of elementary values and their data types are 42 of the Int64 type, true and false of the Bool type, and 'X' of the Char type.

Julia, unlike many modern programming languages, differentiates between single characters and strings. Strings can contain any number of characters and are specified using double quotes, and single quotes are only used for character literals. Variables are the names that are bound to values by assignments, such as x = 42. They have the type of the value they contain (or reference); this type is given by the typeof function. For example, typeof(x) returns Int64.

The type of a variable can change, because putting x = "I am Julia" now results in typeof(x) returning ASCIIString. In Julia, we don't have to declare a variable (that indicates its type) such as in C or Java for instance, but...