• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Round à number to 0, 10, 20, 30 etc...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Round à number to 0, 10, 20, 30 etc...


  • Subject: Re: Round à number to 0, 10, 20, 30 etc...
  • From: Bill Briggs <email@hidden>
  • Date: Sun, 8 Apr 2001 20:03:16 -0300

At 5:54 PM -0400 08/04/01, giZm0 wrote:
Hi, I am looking for a way to round a number (between 1 and 100) to its
3about ten2 (0, 10, 20, 30 etc..).

I tried several times with the 3round command2 but I just cant get it
right....

Can someone help me ?
Currently my script goes like this :
set curvol to (round (value/ 10)) * 10

With no attempt to be brief, but for maximum clarity (and assuming you understand the rules by which AppleScript rounds numbers) this will do what you want.

display dialog "Enter your number and I'll round it to the nearest 10" default answer ""
set x to (text returned of result as number)
set y to x / 10
set z to round y
set z to z * 10
set z to z div 1
display dialog "the rounded number you want is " & z

To be brief about it.

display dialog "Enter your number and I'll round it to the nearest 10" default answer ""
set z to ((round ((text returned of result as number) / 10)) * 10) div 1
display dialog "the rounded number you want is " & z

- web


References: 
 >Round à number to 0, 10, 20, 30 etc... (From: giZm0 <email@hidden>)

  • Prev by Date: Re: When did Remote Access Commands get depreciated?
  • Next by Date: RE: Folder Actions Shortcomings...
  • Previous by thread: Round à number to 0, 10, 20, 30 etc...
  • Next by thread: Excel scripting question
  • Index(es):
    • Date
    • Thread