Understanding the syntax used in the code below

Dear Community,

I have posted a code snippet from a github repository.
The code posted below is at CCBlade.jl/airfoils.jl at master · antarNetra/CCBlade.jl · GitHub lines 267 to 289.
What id do not understand the use of underscores “_”, in the loop with the comment
“iterate over remaining files”. Where can i get more information on this construct.
What i understand from here is that the file contains a vector of strings in this order:
info, Re1, Mach, alpha, cl1, cd1
and when we are reading these values from an array of files we are kind of sending the read in information into null for some strings and for some we are storing it into the variables.

Please point out the topic under which i can read more about it. I looked up in the book Think Julia but could not find any similar construct and right now going through Julia as second language.

function AlphaReAF(filenames::Vector{String}; radians=true)

info, Re1, Mach, alpha, cl1, cd1 = parsefile(filenames[1], radians)  # assumes common alpha across files, also common info and common Mach
nalpha = length(alpha)
ncond = length(filenames)

cl = Array{Float64}(undef, nalpha, ncond)
cd = Array{Float64}(undef, nalpha, ncond)
Re = Array{Float64}(undef, ncond)
cl[:, 1] = cl1
cd[:, 1] = cd1
Re[1] = Re1

# iterate over remaining files
for i = 2:ncond
    _, Rei, _, _, cli, cdi = parsefile(filenames[i], radians)
    cl[:, i] = cli
    cd[:, i] = cdi
    Re[i] = Rei

return AlphaReAF(alpha, Re, cl, cd, info, Mach)


Many Thank and Best Regards

This is the same as

dummy1, Rei, dummy2, dummy3, cli, cdi = parsefile(filenames[i], radians)

except that some values are written to a write-only variable to signal that those values will not (and cannot) be used later.

See Variables · The Julia Language for documentation.


Thanks a lot. The link to the documentation is spot on. Exactly what i was looking for.
Thanks once again.

1 Like