In [1]:
#The type of the value 3
typeof(3)
Out[1]:
In [2]:
#The type of the value 3.0
typeof(3.0)
Out[2]:
In [3]:
#The type of the value pi
typeof(pi)
Out[3]:
In [4]:
#The type of the value 3 // 4
typeof(3 // 4)
Out[4]:
In [5]:
#The type of the value "Julia"
typeof("Julia")
Out[5]:
In [6]:
#What is the supertype (parent) of the Float64 type?
super(Float64)
Out[6]:
In [7]:
#What is the supertype of the FloatingPoint type?
super(FloatingPoint)
Out[7]:
In [8]:
#What is the sypertype of the Real type?
super(Real)
Out[8]:
In [9]:
#What is the supertype of the Number type?
super(Number)
Out[9]:
In [10]:
#What are the children of the type Any?
subtypes(Any)
Out[10]:
In [11]:
#What are the subtypes of the Number type?
subtypes(Number)
Out[11]:
In [12]:
#What are the subtypes of the Complex type?
subtypes(Complex)
Out[12]:
In [13]:
#What are the subtypes of the Real type?
subtypes(Real)
Out[13]:
In [14]:
#What are the subtypes of the FloatingPoint type?
subtypes(FloatingPoint)
Out[14]:
In [15]:
#What are the subtypes of the Integer type?
subtypes(Integer)
Out[15]:
In [28]:
#What is the minimum value an Int8 type object can hold?
typemin(Int8)
Out[28]:
In [30]:
#What is the maximum value a Int16 type ofject can hold?
typemax(Int16)
Out[30]:
In [31]:
#Creating an new abstract type called AbstractTypeOne using the abstract keyword
abstract AbstractTypeOne
In [32]:
#This new abstract type has an automatic supertype
super(AbstractTypeOne)
Out[32]:
In [33]:
#Creating an abstarct type under a specific supertypes using: abstract AbstractTypeTwo <: Number
abstract AbstractTypeTwo <: Number
In [34]:
#Checking using super(AbstractTypeTwo)
super(AbstractTypeTwo)
Out[34]:
In [36]:
#Creating a concrete type with two fields:
#type ConcreteTypeOne <: AbstractTypeOne
# fieldone
# fieldtwo::Int
#end
type ConcreteType <: AbstractTypeOne
fieldone
fieldtwo::Int
end
In [38]:
#Since it is a concrete type it can be instantiated:
#var1 = ConcreteTypeOne("Hi!", 101)
var1 = ConcreteType("Hi!", 101)
Out[38]:
In [39]:
#Accessing the fields of var1 with dot notation
var1.fieldone
Out[39]:
In [40]:
#Since the type of fieldone was not specified we can check the type of var1.fieldone with typeof()
typeof(var1.fieldone)
Out[40]:
In [ ]: