FANDOM


A VM instruction that returns control flow back to the instruction immediately following the most recent call instruction that was executed.

It is important that a ret instruction is only executed after a call instruction, otherwise a call stack underflow will occur and the hakk will crash.

Usage Edit

ret:

hakkML Example Edit

name: call_example
blocks:
  core:
  entry: {name: 'main', loc: [0,1]}
code:
  main:
    - rem: instruct VM to call a label
    - call: go_somewhere
    - out: "I am here second."
    - exit: 0
    - lbl: go_somewhere
    - out: "I am here first."
    - rem: This 'ret' instruction will return to the instruction
    - rem: after the most recent call instruction was made.
    - ret: