fork download
  1. //There are 12 basics primitive data times
  2.  
  3. //Blob -> A collection of binary data stored as a single object
  4.  
  5. Blob blobData = Blob.valueOf('Hello World');
  6. System.debug('Blob Data: ' + blobData);
  7.  
  8. //Boolean -> A value that can be true, false, or null
  9.  
  10. Boolean isWinner = true;
  11. System.debug('Is Winner: ' + isWinner);
  12.  
  13.  
  14. //Date -> A value representing a specific day (no time)
  15.  
  16. Date today = Date.today();
  17. Date tomorrow = today.addDays(1);
  18. System.debug('Today: ' + today);
  19. System.debug('Tomorrow: ' + tomorrow);
  20.  
  21.  
  22. //Datetime -> timestamp
  23.  
  24. Datetime currentTime = Datetime.now();
  25. Datetime futureTime = currentTime.addDays(1);
  26. System.debug('Current Time: ' + currentTime);
  27. System.debug('Future Time: ' + futureTime);
  28.  
  29. //String -> A sequence of characters
  30.  
  31. String greeting = 'Hello, Salesforce!';
  32. System.debug('Greeting: ' + greeting);
  33.  
  34.  
  35. //Integer ->
  36.  
  37. Integer count = 100;
  38. System.debug('Count: ' + count);
  39.  
  40. //Long -> A 64-bit number without a decimal point.
  41.  
  42. Long largeNumber = 2147483648L;
  43. System.debug('Large Number: ' + largeNumber);
  44.  
  45.  
  46. //Decimal -> A number that includes a decimal point
  47.  
  48. Decimal price = 19.99;
  49. System.debug('Price: ' + price);
  50.  
  51. //Double (Floar) -> A 64-bit floating point number
  52.  
  53. Double pi = 3.14159;
  54. System.debug('Pi: ' + pi);
  55.  
  56. //ID -> A unique 18-character Salesforce record identifier (e.g., for Account or Contact)
  57.  
  58. ID recordId = '00300000003T2PGAA0';
  59. System.debug('Record ID: ' + recordId);
  60.  
  61. //Object -> A generic type that can hold any Apex data type
  62.  
  63. Object obj = 42;
  64. Integer i = (Integer)obj;
  65. System.debug('Integer from Object: ' + i);
  66.  
  67. //Time A value representing a specific time of day, without any date or timezone information
  68.  
  69. Time currentTime = Time.now();
  70. System.debug('Current Time: ' + currentTime);
  71.  
Success #stdin #stdout #stderr 0.01s 7832KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
./prog:1: expected expression