Getting the maximum value from a list in Julia – max() Method

The max() is an inbuilt function in julia which is used to return the maximum value of the parameters.

Syntax: max(x, y, …)

Parameters:

  • x: Specified 1st value.
  • y: Specified 2nd value and so on.

Returns: It returns the maximum value of the parameters.

Example 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

# Julia program to illustrate 
# the use of max() method
  
# Getting the maximum value of the parameters.
println(max(1, 2, 3, 4))
println(max(1, 3, 5))
println(max(2, 4, 6))

chevron_right


Output:

4
5
6

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Julia program to illustrate 
# the use of max() method
  
# Getting the maximum value of the parameters.
println(max(0.6, 0.7, 0.2))
println(max(2.5, 3.5, 0.3, 1.7))

chevron_right


Output:

0.7
3.5
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.