I would suggest you go through the coding tutorials on arduino website. It would be absolutely possible to have the above structure in an arduino code.
This likelink has a working and validated example showing while loop calling other function using if-else-if structure.
https://www.arduino.cc/en/Tutorial/WhileStatementConditional?from=Tutorial.WhileLoop
Please go through the tutorials and post specific problem if and when you encounter them.