[Newbies] "Print specific integers" Error message, how to improve ?

RedTigerFish chihuyu at gmail.com
Thu Nov 16 08:19:40 UTC 2017


Hello, *what I want is:*
>From integers 1 to 130, I want to print some specific integers already given
in an array.
They are: 2 32 44 67 89 111 123 which are stored in small-to-big order.

*Here's my codes:*

|a n myArray|

myArray := #(2 32 44 67 89 111 123).

n := 1.
a := myArray at: n. 

1 to: 130 do: [:i|
	i = a
	ifTrue: [
		Transcript show: i; cr.
		n := n + 1. 
		a := myArray at: n.
		].	
	].

The output is very good except for an Error Message. 

<http://forum.world.st/file/t371379/errormessage.png> 

By my current level, I have no idea why that Error Message appears. 

Q1: Why  Error Message appears ? 
Q2: How can I improve that?






-----
Dig, dig where you are,
Down below's well.
Let those that walk in darkness shout, 
Down below's hell.
--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html


More information about the Beginners mailing list