The
Python
Output:
Python
Output:
getfield() is an inbuilt function in julia which is used to extract a named field from the specified value of composite type.
Syntax: getfield(value, name::Symbol) Parameters:Example 1:Returns: It returns the extracted named field from the specified value of composite type.
- value: Specified value of composite type.
- name::Symbol: Specified symbol.
# Julia program to illustrate
# the use of getfield() method
# Getting the extracted named field
# from the specified value of composite type.
a = 5//2
println(getfield(a, :num))
5Example 2:
# Julia program to illustrate
# the use of getfield() method
# Getting the extracted named field
# from the specified value of composite type.
a = 7//3
println(getfield(a, :num))
7