![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Boolean assignment Topic Summary: DXL doesn't behave like C? Created On: 24-Oct-2007 14:16 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Hi Jim, the following works fine in DXL (note the single quotation marks ' instead of the double quotation marks " you used in your original posting. The former are mandatory for char assignments. char name = 'B' bool flag flag = (name == 'S') print flag Cheers, Peter | |
![]() |
|
Hi,
AIUI the following is valid C code (I'm not a C programmer so please forgive syntax errors): char name = "B" boolean flag flag = (name == "S") The point being that in C a boolean value can be assigned the result of a logical comparison. In the example above 'flag' will be assigned 'False' However in DXL this doesn't appear to be allowed. Can someone confirm that this is the case? Presumably the work around is to do the assignment in 'if' statements? TIA Jim ------------------------- Jim Backus<BR>Ultra Electronics, Controls |
|
![]() |
|
![]() |
|
Hi Jim,
the following works fine in DXL (note the single quotation marks ' instead of the double quotation marks " you used in your original posting. The former are mandatory for char assignments. char name = 'B' bool flag flag = (name == 'S') print flag Cheers, Peter |
|
![]() |
|
![]() |
|
char and string are distinct in DXL. Try this:
string name = "B" bool flag = true print flag "\n" flag = (name == "S") print flag "\n" It works. ------------------------- Paul dot Tiplady at TRW dot com TRW Automotive |
|
![]() |
|
![]() |
|
As other said, chars use single quotes ' ' and strings use double quotes " ".
The bool part of your code should work and is in fact used fairly often. Also, I'm a little fuzzy on key words, but since 'name' is the name of a DXL perm, as in "string NameMod = name(mod)", I'd be loath to use 'name' as the name of a variable. I don't know the exact rules but sometimes its going to generate wierd DXL errors. - Louie |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Boolean assignment
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.