Example: while

The following example uses a while statement to loop through string str, searching for the first non-numeric character. The loop will continue until the expression is_digit becomes false i.e when the next character in str is not a digit but a non-numeric character.

    int is_digit = TRUE, i = 0;
    char * str = "1234567k89";
    int len = strlen(str);
    while (is_digit){
        if (i == len) {
            lr_output_message ("No letters found in string");
            return -1;
        }
        is_digit = isdigit(str[i++]);
    }
    lr_output_message ("The first letter appears in character %d of string", i);
Example: Output:
Action.c(18): The first letter appears in character 8 of string