Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Getting tuple of indices in Julia – to_indices() Method

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The to_indices() is an inbuilt function in julia which is used to convert the given tuple I to a tuple of indices for use in indexing into array A.

Syntax: to_indices(A, I::Tuple)

Parameters:

  • A: Specified array
  • I: Specified tuple

Returns: It returns the converted tuple of indices.

Example 1:




# Julia program to illustrate 
# the use of to_indices() method
  
# Getting the converted tuple of indices
A = [1, 2, 3, 4];
t = (10, 20, 30, 40);
println(to_indices(A, t))

Output:

(10, 20, 30, 40)

Example 2:




# Julia program to illustrate 
# the use of to_indices() method
  
# Getting the converted tuple of indices
A = [1, 2];
t = (5, 10, 15, 20, 25);
println(to_indices(A, t))

Output:

(5, 10, 15, 20, 25)
My Personal Notes arrow_drop_up
Last Updated : 21 Apr, 2020
Like Article
Save Article
Similar Reads