Message Boards Message Boards

0
|
7630 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

[?] Make an Infinite loop with Do function?

Posted 7 years ago

Hi all,

I need to make an infinite loop with Do function

Anyone can help me?

Thank you

POSTED BY: shahin eskandri
4 Replies

Another simple thing While[True, ... ] construct:

n = 1; While[True, Pause[1]; Print[n]; n++]
POSTED BY: Vitaliy Kaurov
Posted 7 years ago

The Infinity spec should work:

Do[expr, Infinity]

See http://reference.wolfram.com/language/ref/Do.html#489332529,

Do[expr,Infinity] continues evaluating expr until explicitly told to exit through a function such as Break, Return, Throw, Abort, or Quit.

POSTED BY: Kyle Martin

I imagine verifying it will actually iterate to Infinity would have presented some testing challenges :-)

POSTED BY: Ilian Gachevski
Posted 7 years ago

I need to make an infinite loop with Do function

The latest version 11.2.0 allows this:

Dynamic[i]
Do[i, {i, Infinity}]

But for what purpose do you need it?

POSTED BY: Alexey Popkov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract