#1515 Error in the documentation

poltomb Thu 28 Apr 2011

http://fantom.org/doc/examples/sys-stmts.html

Void stmtIf()
{
  echo("\n--- if/else ---")

  // single if with no else
  b := true
  if (true)
    echo("b is true")
   // if/else
  b = false
  if (true)
    echo("b is true")
  else
    echo("b is false")

  // if/else if/else
  i := 1
  if (i == 0)
    echo("i is 0")
  else if (i == 1)
    echo("i is 1")
  else
    echo("i is > 1")
}

Should be: (changed if (true) to if (b) which makes more sense for the example)

Void stmtIf()
{
  echo("\n--- if/else ---")

  // single if with no else
  b := true
  if (b)
    echo("b is true")
   // if/else
  b = false
  if (b)
    echo("b is true")
  else
    echo("b is false")

  // if/else if/else
  i := 1
  if (i == 0)
    echo("i is 0")
  else if (i == 1)
    echo("i is 1")
  else
    echo("i is > 1")
}

brian Thu 28 Apr 2011

Thanks for reporting, I pushed a fix

Login or Signup to reply.