Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtend2] Difference between val and var ?
[Xtend2] Difference between val and var ? [message #684471] Wed, 15 June 2011 16:11 Go to next message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 108
Registered: October 2010
Senior Member
Within an Xtend class I can use var and val keywords to define variables. E.g.
val String s1
var String s2

What is the difference between val and var ?
Re: [Xtend2] Difference between val and var ? [message #684475 is a reply to message #684471] Wed, 15 June 2011 16:15 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 6495
Registered: July 2009
Senior Member
Hi,

vals are what final is in java.

Xtend <=> Java
val String s1 <=> final String s1 = null
var String s2 <=> String s2

~Christian
Re: [Xtend2] Difference between val and var ? [message #684496 is a reply to message #684475] Wed, 15 June 2011 16:58 Go to previous messageGo to next message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 108
Registered: October 2010
Senior Member
Christian,

Thanks, that is clear. I could not find it in the documentation. Either I did not look good enough, or otherwise it might be good to add this.

jos
Re: [Xtend2] Difference between val and var ? [message #684530 is a reply to message #684496] Wed, 15 June 2011 18:39 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 6495
Registered: July 2009
Senior Member
Hi,

just for completeness: You find it in the Xtend Docs Section Expressions -> Variable Declarations

~Christian

[Updated on: Wed, 15 June 2011 18:39]

Report message to a moderator

Re: [Xtend2] Difference between val and var ? [message #684587 is a reply to message #684530] Wed, 15 June 2011 21:26 Go to previous message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 108
Registered: October 2010
Senior Member
Christian,

thanks, you are right.
I should learn to read better Razz

jos
Previous Topic:EObject from global scope has less information
Next Topic:[Xtext 2.0] Bug in PreferenceStoreAccessImpl?
Goto Forum:
  


Current Time: Wed Nov 26 10:22:48 GMT 2014

Powered by FUDForum. Page generated in 0.02505 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software