Getting additive identity element in Julia – zero() Method Last Updated : 01 Apr, 2020 Improve Improve Like Article Like Save Share Report The zero() is an inbuilt function in julia which is used to return the additive identity element for the type of x, where x might also be type itself. Syntax: zero(x) Parameters: x: Specified value. Returns: It returns the additive identity element for the type of x, where x might also be type itself. Example 1: # Julia program to illustrate # the use of zero() method # Getting the additive identity element # for the type of given parameter println(zero(0)) println(zero(1)) println(zero(5.6)) println(zero(big"2.0")) Output: Example 2: # Julia program to illustrate # the use of zero() method # Getting the additive identity element # for the type of given parameter println(zero(rand(1, 1))) println(zero(rand(2, 2))) println(zero(rand(3, 3))) Output: [0.0] [0.0 0.0; 0.0 0.0] [0.0 0.0 0.0; 0.0 0.0 0.0; 0.0 0.0 0.0] Like Article Suggest improvement Previous Merging Dictionary collections in Julia - merge() and merge!() Methods Next Checking if a number is power of two in Julia - ispow2() Method Share your thoughts in the comments Add Your Comment Please Login to comment...