Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Hroudtwolf
Addict
Posts: 803 Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:
Post
by Hroudtwolf » Mon Nov 03, 2008 1:17 pm
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
Mistrel
Addict
Posts: 3415 Joined: Sat Jun 30, 2007 8:04 pm
Post
by Mistrel » Mon Nov 03, 2008 5:51 pm
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?
Last edited by
Mistrel on Tue Nov 04, 2008 1:39 am, edited 1 time in total.
Kaeru Gaman
Addict
Posts: 4826 Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany
Post
by Kaeru Gaman » Mon Nov 03, 2008 6:30 pm
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....
oh... and have a nice day.
Little John
Addict
Posts: 4779 Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany
Post
by Little John » Mon Nov 03, 2008 10:59 pm
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
Psychophanta
Always Here
Posts: 5153 Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:
Post
by Psychophanta » Mon Nov 03, 2008 11:38 pm
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.
Demivec
Addict
Posts: 4260 Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA
Post
by Demivec » Tue Nov 04, 2008 5:39 pm
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.