• Monika A 22
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies

As per my inderstanding, If we enabled Dev Hub, it will be used as a scratch org.

So scratch org in the sense, all the data from the org will be disposed?Please confirm.
Thanks! 

In this both code, what the string is doing here that is blank value in the string pattern.

I am getting the following result for adding string out of the FOR loop:
*(1)
* * *(3)
* * * * * * (6)
* * * * * * * * * * (10)
* * * * * * * * * * * * * * *(15)


Integer n=5;
string pattern='';
for(Integer row=0;row<n;row++)
{
    for(Integer column=0;column<=row;column++)
    {
        pattern=pattern+' * ';
    }
    system.debug(pattern);
}                       

Result after adding string space in FOR loop:

Integer n = 5;
for(Integer row  = 0; row < n; row++) {
    String pattern = '';
     for(Integer column = 0; column <= row; column++) {
         pattern = pattern + '*  '; // or pattern+='*  ';
    }

    //print pattern here
    System.debug(pattern);
}

Result:
*
*   *
*   *   *
*   *   *   *
*   *   *   *   *

Can you make me understand this code part, as I got stuck here. what is the difference between these two codes.

Thanks!

try {
account acctslist=[select ID, name,site from account where name='Account1'];
acctslist.site='www.account1.com';
account newacct=new account(name='account1');
acctslist.add(newacct);
    upsert acctslist;
} catch (Exception e) {
  system.debug('Issue is:' +e) ; 
      }

I know this code part have some issue in DML, but I dont know how to find and what is the issue in this. Can you please explain the issue with solution.

Thanks!

try {
account acctslist=[select ID, name,site from account where name='Account1'];
acctslist.site='www.account1.com';
account newacct=new account(name='account1');
acctslist.add(newacct);
    upsert acctslist;
} catch (Exception e) {
  system.debug('Issue is:' +e) ; 
      }

I know this code part have some issue in DML, but I dont know how to find and what is the issue in this. Can you please explain the issue with solution.

Thanks!