FaridAgl Posted January 2, 2014 Share Posted January 2, 2014 Check the following example: expandcollapse popup#cs This: If (conditon) Then (do this...) To: (condtion) And (do this...) Example: (True) And MsgBox(0, "", "") #ce #cs This: If (Not condtion) Then (do this...) To: (Not condition) Or (do this...) Example: (False) Or MsgBox(0, "", "") #ce ;-------------------------------------------------- ;This If (FileExists(@ScriptFullPath)) Then MsgBox(0, "Standard", "Exist") EndIf ;To (FileExists(@ScriptFullPath)) And MsgBox(0, "Short", "Exist") ;This If (Not IsAdmin()) Then MsgBox(0, "Standard", "You are not admin") EndIf ;To (IsAdmin()) Or MsgBox(0, "Short", "You are not admin") jaberwacky and mLipok 2 http://faridaghili.ir Link to comment Share on other sites More sharing options...
UEZ Posted January 2, 2014 Share Posted January 2, 2014 (edited) This is not odd - this is boolean algebra. Have a look here -> http://en.wikipedia.org/wiki/Boolean_algebra_(structure)#Examples Checkout the return values of each functions and compare it with the boolean table for and (∧)/ or(∨). Br, UEZ Edited January 2, 2014 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
FaridAgl Posted January 2, 2014 Author Share Posted January 2, 2014 (edited) Well, I know about Boolean algebra, I had passed Boolean algebra in Discrete Mathematics in my previous term! I call it odd because I didn't see anyone using this syntax, however in my opinion it's clear, simple and useful. Also noticed that this kind of syntax usually got used in PHP. Edited January 2, 2014 by D4RKON3 http://faridaghili.ir Link to comment Share on other sites More sharing options...
trancexx Posted January 2, 2014 Share Posted January 2, 2014 (edited) I allowed it with one of the commits some time ago while I was active in development. It's a side affect which needed later proper evaluation. edit: Are you asking for some help about it or what? Edited January 2, 2014 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
FaridAgl Posted January 2, 2014 Author Share Posted January 2, 2014 (edited) Oops no, just wanted to share it with the community as I never seen anyone do this before. Now that you are here, do you know anything about any performance issues with this syntax? As I remember, there was a little different in speed of one line If () Then ... and the Standard If () Then ... EndIf statements. Edit: I allowed it with one of the commits some time ago while I was active in development. It seems like there is a sign of you everywhere! Edited January 2, 2014 by D4RKON3 http://faridaghili.ir Link to comment Share on other sites More sharing options...
jdelaney Posted January 2, 2014 Share Posted January 2, 2014 (edited) hey, look at that: $iTimer = TimerInit() For $i = 0 To 10000000 If True Then $something=$i Next ConsoleWrite(TimerDiff($iTimer) & @CRLF) $iTimer = TimerInit() For $i = 0 To 10000000 If True Then $something=$i EndIf Next ConsoleWrite(TimerDiff($iTimer) & @CRLF) output: 19146.2078164728 10066.2411395331 That seems to be a significant difference. Edited January 2, 2014 by jdelaney mLipok 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
FaridAgl Posted January 2, 2014 Author Share Posted January 2, 2014 Here we go: Global $something $iTimer = TimerInit() For $i = 0 To 10000000 If True Then $something = $i Next ConsoleWrite(TimerDiff($iTimer) & @CRLF) $iTimer = TimerInit() For $i = 0 To 10000000 If True Then $something = $i EndIf Next ConsoleWrite(TimerDiff($iTimer) & @CRLF) $iTimer = TimerInit() For $i = 0 To 10000000 (True) And $something = $i Next ConsoleWrite(TimerDiff($iTimer) & @CRLF) 12924.9980183691 7313.35217241744 9594.36602411256 mLipok 1 http://faridaghili.ir Link to comment Share on other sites More sharing options...
jdelaney Posted January 2, 2014 Share Posted January 2, 2014 My CPU on this comp is a little low, as you can compare from our results IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
FaridAgl Posted January 2, 2014 Author Share Posted January 2, 2014 That's OK http://faridaghili.ir Link to comment Share on other sites More sharing options...
trancexx Posted January 2, 2014 Share Posted January 2, 2014 That's not the same. The code with funny syntax does different things than other two. That expression is stateless (google for definition if not familiar) as opposed to stateful nature of other two: Local $something Local $i = 34 (True) And $something = $i ConsoleWrite($something & @CRLF) ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
FaridAgl Posted January 2, 2014 Author Share Posted January 2, 2014 Thanks, understood. Wondering how the second part got run, but the variable assigned is ignored. Local $something Local $i = 34 (True) And MsgBox(0, '', '') ConsoleWrite($something & @CRLF) Guess it's about being stateless and stateful. http://faridaghili.ir Link to comment Share on other sites More sharing options...
trancexx Posted January 2, 2014 Share Posted January 2, 2014 It's not ignored, it's evaluated and the result is False. I told you it's stateless.Right side means "is $something equal to $i", it doesn't mean "assign $something to value of $i". Get it? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
FaridAgl Posted January 2, 2014 Author Share Posted January 2, 2014 (edited) Yeap, that's clear now. Thanks. Edited January 2, 2014 by D4RKON3 trancexx 1 http://faridaghili.ir Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now