Page 1 of 1
Results of assignments
Posted: Mon Nov 03, 2008 1:17 pm
by Hroudtwolf
Hi,
My little wish is, to have the possibilities in PB for receiving results of assignments.
In example:
Code: Select all
if let ( MyVariable = 100 ) = 100 : CallMyFunction () : endif
(Checking if MyVariable has the value 100.)
... or ...
Code: Select all
resultOfTheAssignment = let ( MyVariable = 100 )
(resultOfTheAssignment receives the value of MyVariable.)
Similar to PHP:
Code: Select all
if ( ( $result = 123 ) == 123 ) echo 1;
if ( ( $result = 123 ) == 321 ) echo 2; // No equivalence
Best regard
Wolf
Posted: Mon Nov 03, 2008 5:51 pm
by Mistrel
I was actually thinking this myself. I think what we're looking for is the ability to evaluate an expression before the 'If'.
I like your idea but is there a solution that does not require the 'Let' keyword?
Posted: Mon Nov 03, 2008 6:30 pm
by Kaeru Gaman
I know that this is possible in C because the Assignor and the Comparator are differerent symbols, "=" and "==".
... but I never really discovered the deeper usefulness of this feature....
Posted: Mon Nov 03, 2008 10:59 pm
by Little John
Kaeru Gaman wrote:... but I never really discovered the deeper usefulness of this feature....
The deeper usefulness of this feature is that it makes the code harder to read.
Regards, Little John
Posted: Mon Nov 03, 2008 11:38 pm
by Psychophanta
Little John wrote:Kaeru Gaman wrote:... but I never really discovered the deeper usefulness of this feature....
The deeper usefulness of this feature is that it makes the code harder to read.

Right!, which converts it in less than a "useful-less" feature.

Posted: Tue Nov 04, 2008 5:39 pm
by Demivec
Kaeru Gaman wrote:I know that this is possible in C because the Assignor and the Comparator are differerent symbols, "=" and "==".
... but I never really discovered the deeper usefulness of this feature....
I not daft but what exactly is the usefulness of this feature? From the examples show I can't see it, a few words of enlightenment from the sages here would go a long way in clearing this up for me.
I am aware of these aspects in the C language but have not used them.