Related Articles

Related Articles

Type conversion of elements in Julia – oftype() Method
  • Last Updated : 26 Mar, 2020

The oftype() is an inbuilt function in julia which is used to convert a given type of element y(say) into x(say) type of element.

Syntax: oftype(x, y)

Parameters:

  • x: Specified first type of element.
  • y: Specified second type of element.

Returns: It returns the converted type of elements.

Example 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

# Julia program to illustrate 
# the use of oftype() method
  
# Getting the converted type of elements.
a = 1;
b = 2.0;
println(oftype(a, b))

chevron_right


Output:

2

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Julia program to illustrate 
# the use of oftype() method
  
# Getting the converted type of elements.
a = 1;
b = 2.0;
println(oftype(b, a))

chevron_right


Output:

1.0
My Personal Notes arrow_drop_up
Recommended Articles
Page :