SexScripts : def or int? - https://ss.deviatenow.com:443/viewtopic.php?f=4&t=347 Page 1 of 1

def or int?

Banjo [ Tue Oct 22, 2013 4:49 pm ]

Minor question from a groovy newbie:

In groovy, should all defines be "def" or should I be using "int" for purely numerical values that need calculations done?

I'm a bit confused if "int" ever needs to be used, as "def" seems to guess what kind of value you wanted anyway. So far, the only time it didn't work was with .replace, when the value was already a number... but I fixed that by using .toString() after much trial and error!

Re: def or int?

doti [ Tue Oct 22, 2013 7:59 pm ]

"int" is from Java ; Java may be harder for newcomers because of a lot of things, notably having stronger types (needing the use of "int")
"def" is Groovy-only ; it is easier. Alas, sometime you need to say to the interpreter : "this is an integer". There, you may use a special syntax to do it, like using "int", "long", "....toString()", etc.,

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