SexScripts : Multiply a Result - https://ss.deviatenow.com:443/viewtopic.php?f=4&t=1143 Page 1 of 1

Multiply a Result

Bdartm3 [ Fri Jan 17, 2025 2:22 am ]

If I am using:

def score = getInteger(“How many questions did you miss?”,0);

If I want to have the program multiply that number by 10 and then use that number in:

show(“That is going to cost you (score x 10) strokes.”);

How would I write that out in Groovy??

Thanks.

Re: Multiply a Result

arthurb [ Fri Jan 17, 2025 11:03 am ]

You can add things including strings together with the + symbol and multiply the number with the * symbol, so the following will display what you want...

show(“That is going to cost you" + (score * 10) + " strokes.”);

Re: Multiply a Result

Bdartm3 [ Fri Jan 17, 2025 8:51 pm ]

Thank you! It worked perfectly.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
https://ss.deviatenow.com:443/
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010, 2011