Short-circuit evaluation

A quick test indicates that Xojo implements short-circuit evaluation, allowing the following code to work even when f is nil:

  f = GetFolderItem(FolderPath, FolderItem.PathTypeShell)
  if f = nil or not f.Exists then
    MsgBox "Folder " + FolderPath + " does not exist, or is not accessible."
    return nil
  end

But, I’ve searched the docs high and low, and can’t find this documented one way or another. Is short-circuit evaluation guaranteed behavior on all platforms?

Thanks.

yes

Perfect… Thanks.

feedback://showreport?report_id=19537

I’m pretty sure I read it in the User’s Guide.


Get it? :slight_smile:

Number Five is alive!

It’s in the Language Reference under the ‘and’ operator (section “Use within If Statements”).