Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 89535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:43:54+00:00 2026-05-10T22:43:54+00:00

I started dabbling in groovy yesterday. There’s an example on the groovy website that

  • 0

I started dabbling in groovy yesterday. There’s an example on the groovy website that I understand but I would like to know more about why it works the way it does. What’s confusing me is who[1..-1]. Is this like saying who[1..who.length()-1]? I can’t find any documentation on this syntax. Are there any good groovy tutorials out there besides what is on http://groovy.codehaus.org/?

class Greet {   def name   Greet(who) { name = who[0].toUpperCase() +                       who[1..-1] }   def salute() { println 'Hello $name!' } }  g = new Greet('world')  // create object g.salute()              // Output 'Hello World!' 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:43:55+00:00Added an answer on May 10, 2026 at 10:43 pm

    You’re right — a negative number in a range basically refers to the end of the list, rather than the beginning. -x is equivalent to who.length()-x.

    What you’re dealing with is known as slices in Python. (I mention the terminology because searching for something like ‘groovy slices’ may help you find more information, although I don’t know if they’re actually called ‘slices’ in reference to Groovy.) You can find more information on this particular syntax feature here.

    As for other resources, I found the book Groovy in Action to be quite handy for learning Groovy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started working on my master branch thinking that my task would be easy.
I started using subversion for one of my projects and it would be absolutely
Just started getting a bunch of errors on our C# .Net app that seemed
Morning folks. Novice Rich here once again requesting assistance. I have just started dabbling
I have a project that i started as a WinForms application as that was
I have been dabbling in programming/scripting languages since I was a kid. I started
Started to learn some shell scripting. I have a perl script that runs on
Started researching Transfer ORM recently and find it pretty cool. Today I've noticed that
Started playing around with jQuery and the jsTree plugin yesterday, and have it successfully
I started using Python in 2001. I loved the simplicity of the language, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.