markyparky56 wrote:
nXIII wrote:
johnnydean1 wrote:
yep
I'm not really sure what you meant here. I'll explain.
markyparky56 wrote:
As in places to put code?As in unevaluated code. For example,
Code:
sandwich := [:bread :toppings | {'Bread: ', bread asString. 'Toppings: ', toppings asArray asString}].This tells me how to make a sandwich (array with two strings, "Bread: bread_type" and "Toppings: toppings") with just the toppings and bread given. I can do this as many times as I want with whatever things I want by simply typing
Code:
sandwich value: 'bread' value: #(topping topping topping). "or even" sandwich value: self basicsize asString, ' different kinds!' value: {self. self class}.However, to simply put
Code:
bread := 'Wheat'. toppings := #(cheese lettuce tomato). sandwich := {'Bread: ', bread. 'Toppings: ', toppings}.would only give me one sandwich, and I wouldn't know how to make another one of a different type without doing all that again manually.
So its making a class?
No... it's like a BYOB lambda
Offline
bbbeb wrote:
How do you stop it if its false? doReturn or something like that?
[variable to test] ifTrue: [ extra scripts, include brackets ] ^ self
Offline