Open In App

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

Improve
Improve
Like Article
Like
Save
Share
Report

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:




# 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))


Output:

4
5
6

Example 2:




# 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))


Output:

0.7
3.5

Last Updated : 21 Apr, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads