code_junkie

C# logic order and compiler behavior

Nov 10th, 2011
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. DataTable myDt = new DataTable();
  2. if (myDt != null && myDt.Rows.Count > 0)
  3. {
  4. //do some stuff with myDt
  5. }
  6.  
  7. myDt != null
  8.  
  9. myDt.Rows.Count > 0
  10.  
  11. if( x isNot Nothing AndAlso x.go()) then
  12.  
  13. if ( x.init() And y.init()) then x.process(y)end y.doDance()
  14.  
  15. if (amHungry & whiteCastleIsNearby){ // The code will check if White Castle is nearby // even when I am not hungry}if (amHungry && whiteCastleIsNearby){ // The code will only check if White Castle is nearby // when I am hungry}
  16.  
  17. puts message unless message.nil?
  18.  
  19. unless message.nil? puts messageend
  20.  
  21. a = new Log(); // Log class overloads the + operatora + "some string"; // Call the overloaded method - otherwise this wouldn't work because you can't normally add strings to objects.
  22.  
  23. a() || b() // be never runs if a is true
  24.  
  25. if (a() && b())
  26.  
  27. if (a() & b())
  28.  
  29. a = Foo( 5, GetSummary( "Orion", GetAddress("Orion") ) );
  30.  
  31. a = Foo(5, GetSummary("Orion", GetAddress("Orion")), GetSummary("Chris", GetAddress("Chris")));
  32.  
  33. READ 0100 WRITE 0010 EXEC 0001
  34.  
  35. flags = READ & EXEC; // value of flags is 0101
  36.  
  37. if ( x.init() And y.init()) then
  38. x.process(y)
  39. end
  40. y.doDance()
  41.  
  42. Dim x As Formatting = Formatting.Bold Or Formatting.Italic
  43. If (x And Formatting.Italic) = Formatting.Italic Then
  44. MsgBox("The text will be set in italic.")
  45. End If
Add Comment
Please, Sign In to add comment