The vect()
is an inbuilt function in julia which is used to create a vector with the passed elements as parameter.
Syntax: vect(X…)
Parameters:
- X: Specified elements.
Returns: It returns the created vector formed by the elements passed as parameter.
Example 1:
# Julia program to illustrate # the use of vect() method # Getting the created vector formed # by the elements passed as parameter println(Base.vect( 1 , 2 , 3 , 4 ))
println(Base.vect( 1.0 , 2.1 , 3.2 , 4.5 ))
println(Base.vect( "a" , "b" , "c" ))
println(Base.vect( "ab" , "bc" , "cd" ))
|
Output:
Example 2:
# Julia program to illustrate # the use of vect() method # Getting the created vector formed # by the elements passed as parameter println(Base.vect(UInt8( 6 ), 2 , 1 ))
println(Base.vect(UInt8( 1 ), 3.6 , 1 / / 2 ))
println(Base.vect(UInt8( 1 ), 2.5 , 8.0 ))
println(Base.vect(UInt8( 5 ), UInt16( 25 ), UInt32( 198 )))
|
Output:
Article Tags :
Recommended Articles