Recent

Author Topic: How can i get more than one thing in an if command.  (Read 2581 times)

Damien

  • Guest
How can i get more than one thing in an if command.
« on: October 28, 2017, 01:54:27 pm »
for example: if button1.caption='thing1' or 'thing2' then

is there any possibility to do something like that?
thx for help

mai

  • Full Member
  • ***
  • Posts: 133
  • truther
Re: How can i get more than one thing in an if command.
« Reply #1 on: October 28, 2017, 01:55:54 pm »
sure

if (a=1) or (a=2) then
begin
write('LOL');
end;

Damien

  • Guest
Re: How can i get more than one thing in an if command.
« Reply #2 on: October 28, 2017, 02:04:35 pm »
okay thank you , i am new to lazarus and u helped me a lot :D

munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: How can i get more than one thing in an if command.
« Reply #3 on: October 28, 2017, 02:44:04 pm »
And if you have only one statement you don't need the begin..end block:

Code: Pascal  [Select][+][-]
  1. if (button1.caption = 'thing1') or (button1.caption = 'thing2') then
  2.   button1.caption := 'thing3';
« Last Edit: October 28, 2017, 04:27:13 pm by Munair »
keep it simple

bee

  • Sr. Member
  • ****
  • Posts: 393
Re: How can i get more than one thing in an if command.
« Reply #4 on: October 28, 2017, 02:51:20 pm »
Perhaps you should read some tutorials about Pascal language. Here's one example: https://www.tutorialspoint.com/pascal/ from Tutorials Point.
There are many other more on the internet.
-Bee-

A long time pascal lover.

mai

  • Full Member
  • ***
  • Posts: 133
  • truther
Re: How can i get more than one thing in an if command.
« Reply #5 on: October 28, 2017, 03:23:26 pm »
thank god no one moaned about the superfluous ;

 

TinyPortal © 2005-2018