# `ret`

[RISC-V Documentation](https://asm-editor.specy.app/documentation/risc-v.md) › [Instructions](https://asm-editor.specy.app/documentation/risc-v/instruction.md)

Web page: https://asm-editor.specy.app/documentation/risc-v/instruction/ret

**Return** · Pseudo-instruction

Category: Control flow

Returns from a subroutine by jumping to the address in ra.

[RISC-V manual: jalr](https://docs.riscv.org/reference/isa/v20260120/unpriv/rv32.html#norm:jalr_op)

Used in: [jal, ret and the calling convention](https://asm-editor.specy.app/learn/courses/risc-v/think-in-assembly/jal-ret-and-the-calling-convention.md) (RISC-V assembly), [Floating point and the F and D extensions](https://asm-editor.specy.app/learn/courses/risc-v/think-in-assembly/floating-point-and-the-f-and-d-extensions.md) (RISC-V assembly), [A subroutine with its arguments in registers](https://asm-editor.specy.app/learn/courses/risc-v/examples/subroutine-with-register-arguments.md) (RISC-V assembly), [Stack arguments and a stack frame](https://asm-editor.specy.app/learn/courses/risc-v/examples/subroutine-with-stack-arguments.md) (RISC-V assembly), [Recursion: factorial and Fibonacci](https://asm-editor.specy.app/learn/courses/risc-v/examples/factorial-and-fibonacci.md) (RISC-V assembly), [Print a nonnegative number in bases 2–36](https://asm-editor.specy.app/learn/courses/risc-v/examples/number-to-string.md) (RISC-V assembly), [Drawing shapes on the screen](https://asm-editor.specy.app/learn/courses/risc-v/examples/drawing-on-the-screen.md) (RISC-V assembly), [A bouncing ball](https://asm-editor.specy.app/learn/courses/risc-v/examples/bouncing-ball.md) (RISC-V assembly), [Move a square with the keyboard](https://asm-editor.specy.app/learn/courses/risc-v/examples/keyboard-control.md) (RISC-V assembly), [The snake game](https://asm-editor.specy.app/learn/courses/risc-v/examples/snake.md) (RISC-V assembly)

## Forms

- `ret`
  - `ret` → `jalr zero, ra, 0`

## Example

```riscv
# la sets ra to the local done label to simulate a function return. ret transfers there, where t2 becomes 1.
.text
li t2, 0
la ra, done
ret
addi t2, t2, 100
done:
addi t2, t2, 1
```
