Infinite loops

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Infinite loops

Jim O'Brien
I’m using a MacBook Pro and can’t find a way to escape an infinite loop such as this:

x := 0. [x >= 0] whileTrue: [x := x +1. Transcript show: 'infinite loop ', x; cr]

The the interrupt key (Alt- or Cmd-) does not work, instead I have to force quite Squeak.  Is there a reliable to way to escape an endless loop?






_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Infinite loops

David T. Lewis
On Thu, Dec 07, 2017 at 11:59:34AM -0500, obrienj wrote:
> I???m using a MacBook Pro and can???t find a way to escape an infinite loop such as this:
>
> x := 0. [x >= 0] whileTrue: [x := x +1. Transcript show: 'infinite loop ', x; cr]
>
> The the interrupt key (Alt- or Cmd-) does not work, instead I have to force quite Squeak.  Is there a reliable to way to escape an endless loop?
>

The interrupt key definitely should work in a case like this. I tried your example
on my Linux computer, and was able to interrupt it without any problem.

Could someone with a Mac please check this and make sure it works? Maybe it is a
key mapping issue (just guessing).

Dave

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Infinite loops

Michael Rice
In reply to this post by Jim O'Brien
Change your test condition to limit your infinite loop.

x := 0. [x <= 4] whileTrue: [x := x +1. Transcript show: 'infinite loop ', x; cr].


infinite loop 1
infinite loop 2
infinite loop 3
infinite loop 4
infinite loop 5

Even in a language that supports a "break" command the user must specify the condition for the break in his code.



On Thu, Dec 7, 2017 at 11:59 AM, obrienj <[hidden email]> wrote:
I’m using a MacBook Pro and can’t find a way to escape an infinite loop such as this:

x := 0. [x >= 0] whileTrue: [x := x +1. Transcript show: 'infinite loop ', x; cr]

The the interrupt key (Alt- or Cmd-) does not work, instead I have to force quite Squeak.  Is there a reliable to way to escape an endless loop?






_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Infinite loops

Jim O'Brien
It's not a question of how to avoid an infinite loop, the question is what to do if you end up with an unintended one. Supposedly, with a mac Cmd- should interrupt execution, but it doesn't seem to work. 




-------- Original Message --------
Subject: Re: [Newbies] Infinite loops
Local Time: December 7, 2017 6:34 PM
UTC Time: December 8, 2017 2:34 AM
To: obrienj <[hidden email]>, A friendly place to get answers to even the most basic questions about Squeak. <[hidden email]>

Change your test condition to limit your infinite loop.

x := 0. [x <= 4] whileTrue: [x := x +1. Transcript show: 'infinite loop ', x; cr].


infinite loop 1
infinite loop 2
infinite loop 3
infinite loop 4
infinite loop 5

Even in a language that supports a "break" command the user must specify the condition for the break in his code.



On Thu, Dec 7, 2017 at 11:59 AM, obrienj <[hidden email]> wrote:
I’m using a MacBook Pro and can’t find a way to escape an infinite loop such as this:

x := 0. [x >= 0] whileTrue: [x := x +1. Transcript show: 'infinite loop ', x; cr]

The the interrupt key (Alt- or Cmd-) does not work, instead I have to force quite Squeak.  Is there a reliable to way to escape an endless loop?






_______________________________________________
Beginners mailing list



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
cbc
Reply | Threaded
Open this post in threaded view
|

Re: Infinite loops

cbc
You are pressing Cmd and the period key, right?  The text in the email doesn't show the period.  You need those two keys to interrupt.

-cbc

On Thu, Dec 7, 2017 at 8:54 PM, obrienj <[hidden email]> wrote:
It's not a question of how to avoid an infinite loop, the question is what to do if you end up with an unintended one. Supposedly, with a mac Cmd- should interrupt execution, but it doesn't seem to work. 




-------- Original Message --------
Subject: Re: [Newbies] Infinite loops
Local Time: December 7, 2017 6:34 PM
UTC Time: December 8, 2017 2:34 AM
To: obrienj <[hidden email]>, A friendly place to get answers to even the most basic questions about Squeak. <beginners@lists.squeakfoundation.org>

Change your test condition to limit your infinite loop.

x := 0. [x <= 4] whileTrue: [x := x +1. Transcript show: 'infinite loop ', x; cr].


infinite loop 1
infinite loop 2
infinite loop 3
infinite loop 4
infinite loop 5

Even in a language that supports a "break" command the user must specify the condition for the break in his code.



On Thu, Dec 7, 2017 at 11:59 AM, obrienj <[hidden email]> wrote:
I’m using a MacBook Pro and can’t find a way to escape an infinite loop such as this:

x := 0. [x >= 0] whileTrue: [x := x +1. Transcript show: 'infinite loop ', x; cr]

The the interrupt key (Alt- or Cmd-) does not work, instead I have to force quite Squeak.  Is there a reliable to way to escape an endless loop?






_______________________________________________
Beginners mailing list



_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Infinite loops

Bert Freudenberg
In reply to this post by Jim O'Brien
On Thu, Dec 7, 2017 at 5:59 PM, obrienj <[hidden email]> wrote:
I’m using a MacBook Pro and can’t find a way to escape an infinite loop such as this:

x := 0. [x >= 0] whileTrue: [x := x +1. Transcript show: 'infinite loop ', x; cr]

The the interrupt key (Alt- or Cmd-) does not work, instead I have to force quite Squeak.  Is there a reliable to way to escape an endless loop?

​On a Mac it's Cmd and Period:
Inline image 1
- Bert -



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners