Skip to content

Conditional expression must be either alone or inside parenthesis #11

Description

@Shachar

As currently implemented, conditional expressions must either come alone (i.e. - not interact with any other operator), or surrounded by parenthesis. So, this is legal:

def chain( number : U64 ) -> U64 {
  if( numer%2 == 0 ) {
    number/2
  } else {
    number*3 + 1
  }
}

And this is also legal:

def chain( number: U64 ) -> U64 {
  ( if(number>12) {number} else {12} ) + 5
}

But this isn't:

def chain( number: U64 ) -> U64 {
  if(number>12) {number} else {12} + 5
}

Currently, this is a limitation of the parser, but we need a debate on whether that's actually a good restriction on conditional expressions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    language designNeed to make a desion about the design of the language

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions