# Chapter 23: Methods and Revisiting Types In this chapter we add *methods*, functions defined in structs which take a hidden `self` argument and can access the struct fields. Here is an `indexOf` method in a String-like class: ```java // A String-like class, with methods struct String { u8[~] buf; // Buffer of read-only characters // Return the index of the first character 'c' or -1 val indexOf = { u8 c -> // Hidden 'self' argument for( int i=0; i