Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Syntax sugar

An overview of syntax sugars present in Fuzion.

if-else synatx sugar
          
if cond1
  block1
else if cond2
  block2
else
  block3
          
        
          
match cond1
  TRUE =>
    block1
  FALSE =>
    match cond2
      TRUE =>
        block2
      FALSE =>
        block3
          
        
dot-type syntax sugar
          
i32.type
          
        
          
Types.get i32
          
        
Loop syntax sugar
          
for i := 1, i+1
    j in 1..10
    k := i+j
while while_cond
  loop_block
until until_cond
else
  else_block
          
        
          
# NYI update once loop issues are fixed, e.g.: #228
i := 1
loop_else => i
loop_list := (1..10).as_list
match loop_list
  cons Cons =>
    loop(i, j i32, tail list i32, k i32) =>
      loop_else =>
        i
      if k.infix < 10
        say "something"
        k
        if i.infix > 5
          k
        else
          match tail
            cons Cons =>
              loop i+1 cons.head cons.tail i+j
            nil =>
              loop_else
      else
        loop_else
    loop i cons.head cons.tail i+j
  nil =>
    loop_else
          
        
Anonyomous Features, syntax sugar
          
ref : String
  utf8 => []
          
        
          
Anonyomous ref : String is
  utf8 => []
Anonyomous  # call to Anonymous