0
$\begingroup$

This question already has an answer here:

Apologies ahead of time, I don't fully understand what I'm asking...

But, is it possible to program using only 'while loops' and still be Turing equivalent?

Or more generally, can I do everything with 'while loops' that I could with 'if statements' and 'for loops'?

$\endgroup$

marked as duplicate by David Richerby, Evil, Yuval Filmus computability Sep 23 '18 at 4:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0
$\begingroup$

for(X; Y; Z) { Body; } is just syntax sugar for {X; while (Y) { Body; Z; }}.

if can be simulated easily: rewrite if (X) { Body; } as while (X) { Body; break; }.

$\endgroup$
  • $\begingroup$ So can I achieve Turing equivalency using only the 'while loop'? $\endgroup$ – XYZandMe Sep 18 '18 at 16:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.