Getter Functions

Functions that return values typically follow one of two styles:

  • Prepending get_ to the start of the name
  • Omitting get_

Encouraged

In Sway the encouraged usage is to omit the get_ prefix.

fn maximum_deposit() -> u64 {
    100
}

Discouraged

That is to say the following is discouraged.

fn get_maximum_deposit() -> u64 {
    100
}