Merging collapsible if statements increases the code's readability.
if !filename.nil?
if File.file?(filename) || File.directory?(filename)
# ...
end
end
if a then
unless b then
# ...
end
end
def isFileOrDirectory(filename) File.file?(filename) || File.directory?(filename) end # ... if !filename.nil? && isFileOrDirectory(filename) # ... end if a && !b then # ... end