wilzbach / tools-test

1 stars 0 forks source link

How to resolve the warning explicit braces to avoid ambiguous else #139

Closed wilzbach closed 8 years ago

wilzbach commented 8 years ago

Note: the issue was created automatically migrated from https://issues.dlang.org

Original bug ID: BZ#15716 From: Varsh <Varsh.rk14@gmail.com> Reported version: D2 CC: mathias.lang@sociomantic.com

wilzbach commented 8 years ago

Comment author: Varsh <Varsh.rk14@gmail.com>

No description provided.

wilzbach commented 8 years ago

Comment author: Mathias Lang <mathias.lang@sociomantic.com>

If you have any question, please direct them to the "learn" section of the forum: https://forum.dlang.org/group/learn as we only use bugzilla for defect.

To answer your question, do exactly what the warning suggest: nest your statement within braces, so that code like:

if (foo)
  if (bar)
    call();
  else
    otherCall();

Becomes:

if (foo)
{
  if (bar)
    call();
  else
    otherCall();
}

Closing as it is not a bug.