Define types for multiple return values

I am new and probably it is a silly question, but couldn’t find a way to do this.
I have a function and would like for all the return variables to be of the given type. Apparently I can use this syntax for only one variable in return type. The following fails:

function getDataMol(mol::Molecule)  ::Int32, ::Int32, ::Int32, ::Int32 
natoms = length(mol.atoms)
nrelectrons=0
nCGF=0
nGTO=0
   ----- implementation -----
   return natoms, nrelectrons, nCGF, nGTO
end

You are actually returning a tuple, so try this:

julia> function f(x, y)::Tuple{Int, Int}
         return x, y
       end
f (generic function with 1 method)

julia> f(1, 2)
(1, 2)

julia> f(1.0, 2.0)
(1, 2)
6 Likes

Thanks, it solves my problem.