Repository: incubator-systemml Updated Branches: refs/heads/gh-pages 6f1aab2bc -> 0cfc00c3d
Corrected typo in 'if statement' syntax documentation Closes #102. Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/0cfc00c3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/0cfc00c3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/0cfc00c3 Branch: refs/heads/gh-pages Commit: 0cfc00c3dbd9174965495d8a02aafb2df2c6b017 Parents: 6f1aab2 Author: Yifan "Ethan" Xu <[email protected]> Authored: Tue Apr 5 16:40:40 2016 -0700 Committer: Deron Eriksson <[email protected]> Committed: Tue Apr 5 16:40:40 2016 -0700 ---------------------------------------------------------------------- dml-language-reference.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/0cfc00c3/dml-language-reference.md ---------------------------------------------------------------------- diff --git a/dml-language-reference.md b/dml-language-reference.md index 64fd950..092a09b 100644 --- a/dml-language-reference.md +++ b/dml-language-reference.md @@ -274,17 +274,22 @@ The predicate in the while statement consist of operations on scalar variables a The syntax for an if statement is as follows: - if (predicate) { + if (predicate1) { statement1 statement2 ... - } [ else { + } [ else if (predicate2){ + statement1 + statement2 + ... + } ] [ else { statement1 statement2 ... } ] -The If statement has two bodies: the if body (evaluated if the predicate evaluates to true) and the optional else body (evaluated otherwise). Both, the statements in the if body and else body must be surrounded by braces, even if the body only has a single statement. The if body and else body may contain any sequence of statements. + +The If statement has three bodies: the `if` body (evaluated if predicate1 evaluates to true), the optional `else if` body (evaluated if predicate2 evaluates to true) and the optional `else` body (evaluated otherwise). There can be multiple `else if` bodies with different predicates but at most one `else` body. The bodies may contain any sequence of statements. If only a single statement is enclosed in a body, the braces surrounding the statement can be omitted. ##### Examples
