/**
 * Given a list of names and a target name, find the index at which the target name occurs using a while loop.
 *
 * @param names A list of strings representing names (e.g., ['John', 'Jane', 'Alex', 'Emily'])
 * @param target A string representing the name to be found
 * @return An integer representing the index at which the target name occurs in the list. If the name is not found, return -1.
 */
fun indexWhileLoop(names: List<String>, target: String): Int {

    var index = 0
    while (index < names.size) {
        if (names[index] == target) {
            return index
        }
        index++
    }
    return -1
}
/**
 * Given a list of names and a target name, find the index at which the target name occurs using a while loop.
 *
 * @param names A list of strings representing names (e.g., ['John', 'Jane', 'Alex', 'Emily'])
 * @param target A string representing the name to be found
 * @return An integer representing the index at which the target name occurs in the list. If the name is not found, return -1.
 */
fun indexWhileLoop(names: List<String>, target: String): Int {
/**
 * Given a list of names and a target name, find the index at which the target name occurs using a while loop.
 *
 * @param names A list of strings representing names (e.g., ['John', 'Jane', 'Alex', 'Emily'])
 * @param target A string representing the name to be found
 * @return An integer representing the index at which the target name occurs in the list. If the name is not found, return -1.
 */
fun indexWhileLoop(names: List<String>, target: String): Int {

    var index = 0
    while (index < names.size) {
        if (names[index] == target) {
            return index
        }
        index++
    }
    return -1
}