Monday, 11 April 2016

Julia: Get all the field names of composite type


‘fiednames’ function return all the field names of a composite type.
julia> type Student
           firstName::ASCIIString
           lastName::ASCIIString
           id::Int32
       end

julia> stud1 = Student("Hari Krishna","Gurram", 514)
Student("Hari Krishna","Gurram",514)

julia> fieldnames(stud1)
3-element Array{Symbol,1}:
 :firstName
 :lastName 
 :id       



Previous                                                 Next                                                 Home

No comments:

Post a Comment