Skip to content

feat: ternary operator #1215

@DavePearce

Description

@DavePearce

The purpose of the ternary operator is to enable straight-line instruction sequences, such as the following:

const INC = 0x01
const DEC = 0x03

fn apply(inst u8, arg1 u32) -> (res u33) {
   var isInc, isDec u1
   ;;
   isInc = (inst == INC) ? 1 : 0
   isDec = (inst == DEC) ? 1 : 0
   ;;
   res = (isInc * (arg1+1)) + (isDec*(arg1-1))
   return
}

One of the challenges is how to split this operation, but this could be left for a later date.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions