In C/C++, it would look like this:
- while (condition) statement
- do statement while (condition)
, where condition is any expression that can be evaluated to a boolean (true/false value) and statement is the instruction(s) that needs to be executed as long as the condition evaluates to true. Every time the statement is executed, the condition is re-evaluated to check if it's still true.
For more details, please visit: https://en.cppreference.com/w/cpp/language/while
Other languages should have similar logic. You should be able to find online references for your language of interest.
You can consider the below "pseudo-code":
#include <stdio.h>
int main()
{
int money = 100;
while (money > GetIceCreamPrice())
money -= GetIceCreamPrice();
do
{
money += Work();
} while (money < GetCarPrice());
return 0;
}