Ah that is very helpful - thank you. addFirst: newObject "Add newObject to the beginning of the receiver. Answer newObject."
firstIndex = 1 ifTrue: [self makeRoomAtFirst]. firstIndex := firstIndex - 1. *array* at: firstIndex put: newObject. ^ newObject On Wed, Oct 18, 2017 at 2:41 PM, David Mason <dma...@ryerson.ca> wrote: > In Pharo, open a browser on OrderedCollection, then click "Variables" in > the top left of the window and then "array"... if you scroll through you > can see that mostly OrderedCollection methods use it, but some > SortedCollection (a subclass) methods also use it. > > The model is similar to protected in Java (see http://docs.oracle.com/ > javase/tutorial/java/javaOO/accesscontrol.html ) except there is no > "Package" column. > > On 17 October 2017 at 23:30, James Ladd <ladd.ja...@gmail.com> wrote: > >> Please could you provide an example? >> >> >> >> On Wed, Oct 18, 2017 at 2:16 PM, David Mason <dma...@ryerson.ca> wrote: >> >>> Any instance method in the class where the instance variable is defined >>> or in a subclass can access the instance variable. Similarly for class >>> methods to access class-side variables, and for class and instance methods >>> to access class variables. >>> >>> On 17 October 2017 at 23:04, James Ladd <ladd.ja...@gmail.com> wrote: >>> >>>> Hello Pharo Users, >>>> >>>> I'm wondering about instance variables for support in Redline Smalltalk >>>> and >>>> want to get my understanding straight. >>>> >>>> Are instance variables only accessible (without using #instVarNamed:) >>>> inside >>>> the method with the same name as the instance variable? >>>> >>>> eg: >>>> >>>> myInstVar >>>> ^ myInstVar. >>>> >>>> Or can you reference an instance variable from a method that doesn't >>>> have >>>> the same name ? >>>> >>>> anotherMethod >>>> ^ myInstVar. >>>> >>>> Can someone give me or point me to an example of accessing an instance >>>> variable in Pharo Smalltalk? >>>> >>>> - James. >>>> >>>> >>>> >>>> >>>> -- >>>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html >>>> >>>> >>> >> >