↔️If Statements

If-statement syntax

if <expr> {
    <if statement body>
}
elif <expr> {
    <else if statement body>
}
else {
    <else statement body>
}

Working Example

package main

import "fmt" as fmt


fun main(): Unit {
  let isInRelationship = false
  let isProgrammer = true
  if isProgrammer && !isInRelationship {
    fmt.println("Makes sense")
  }
  elif !isProgrammer && isInRelationship {
    fmt.println("Makes sense")
  }
  elif !isProgrammer && !isInRelationship {
    fmt.println("It's ok, it won't be hard for you to find a relationship")
  }
  else {
    fmt.println("Stop lying")
  }
}

Last updated