[SOLVED] Help with "dynamic" statement with string and pin state

Here is my code:

else if (txtmsg.compareTo("status") == 0)
  {
     String statustxt = "";
     pinstate = digitalRead(pin);
     if (pinstate == 1){
     sms.remoteNumber(remoteNumber, 10);
     sms.beginSMS(remoteNumber);
     sms.print(statustxt);
     sms.endSMS();
     }
  }

I need to complete the code to do next (my pseudo code)
if txt message is status do next:
if pinstatus == 1
sting is: relay 'pin' is on
else
string is: relay 'pin' is off
sms.remoteNumber(remoteNumber, 10);
sms.beginSMS(remoteNumber);
sms.print(string);
sms.endSMS();

My brain is stuck, I mean I am stuck at how to create one string with two states.

My brain is stuck, I mean I am stuck at how to create one string with two states.

Probably because that isn't what you want to do. You want to create a string (or String) with one of two different states.

char stg[32];
if(i == 27)
   strcpy(stg, "The value really is 27");
else
   strcpy(stg, "The value is not 27");

Random
indenting
even in
psuedo code
really isn't
a good
idea.

Ok. Thanks for the tip. But when I enter the line sms.print(stg);
What is going to print?

Ok. Thanks for the tip. But when I enter the line ... What is going to print?

Whatever is in stg.

Do not post snippets here and expect much other than smart-assed answers.

Solved.

else if (txtmsg.compareTo("status") == 0)
  {
    char stg[32];
    if (digitalRead(pin) == HIGH){
      strcpy(stg, "Relej je ukljucen.");
    }
    else {
      strcpy(stg, "Relej je iskljucen.");
    }
    Serial.println(stg);
    sms.remoteNumber(remoteNumber, 10);
    sms.beginSMS(remoteNumber);
    sms.print(stg);
    sms.endSMS();
  }