Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pharo creating a global variable like transcript

I want to create a variable named MameGap which is accessible from every where. I can print some words to transcript for ex. from a method of a class. I want to do this for MameGap too.

I tried something like this

MameGap:= MyClass new.
Smalltalk at: #myMap put: MameGap.

I want to access MameGap like this

doSomething: aVar
   |x|
   x:= MameGap getInt.
   ^x*3
like image 921
arslanbenzer Avatar asked Jun 19 '26 14:06

arslanbenzer


1 Answers

You have to do:

Smalltalk at: #MameGap put: MyClass new

also you can put there just a class object, like

 Smalltalk at: #MameGap put: MyClass

and sen to it class-side messages

like image 122
Uko Avatar answered Jun 22 '26 00:06

Uko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!