JohnRob
February 11, 2025, 1:54am
1
I thought this would be easy but I'm having trouble making this conversion.
Can you suggest where I went astray?
def testSyntax(){
def float OTf = 75.3
def String OTs = toString(OTf)
def int msgLen = OTs.length()
log.info "string length$msgLen"
}
String OTs = OTf.toString()
2 Likes
JohnRob
February 11, 2025, 2:27am
3
Thanks.
I should have seen that as the next line is correct. I just have to get used to the different structure from C (not that I'm very good at C )
1 Like
Wait until you’re on your 8th or 9th language, all of the constructs start running together particularly when your bloodstream is low on caffeine.
5 Likes
You dont need def in front of everything, that is typically only used if you dont specify a type at all. Some people write entire apps/drivers with no variable types at all and I hate it.
This should also work to make it a string, not sure which way is better or proper.
String OTs = "${OTf}"
1 Like
jtp10181:
String OTs = "${OTf}"
Not sure which is more efficient but both definitely work.
system
Closed
February 11, 2026, 3:02am
7
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.