✅ Taking a value out of a method and putting it into another
For this, i want the value inside price() that is the currentPizzaPrice and i want it to go into the totalPrice() method, how can i do this?
6 Replies
Return that value from this method
Instead of returning a string
but i want the string to be returned, is there a way to take it out without changing the returned value?
Well, you can return, say, a record or a class that contains both
You can always override ToString() method
Or even a tuple
That said, i would definitely be better if you were to return the bare value and add the string thingamajigs to it only when displaying it
So instead of
you'd just do
Or whatever else you need
ohhh alright that makes sense, thanks!