Search the web
Sign In
New User? Sign Up
squeak
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 94852 - 94852 of 143988   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#94852 From: Cornelius Huber <corny@...>
Date: Mon May 23, 2005 1:05 pm
Subject: Re: power of a number
corny@...
Send Email Send Email
 
Guenther Schmidt wrote:

> Hi,
>
> I can't figure this out by myself.
>
> I want to do an arithmetic expression like:
>
> 2 power 3, ie. (2 * 2 * 2).
>
> What's the right syntax in Squeak Smalltalk?
>
> Günther
>
my suggestion would be to implement a method called power: in the
category Number

power: aNumber

     | result |
     aNumber timesRepeat: [result := result * self].
     ^result.


Of Course in the case of power, there is already a method implemented
called 'raisedTo:'
Corny

Messages 94852 - 94852 of 143988   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help