If … Then … Else

8 03 2013

IF your device crashed THEN

restore it from a backup

ELSE

use it for improving your life

END IF

Software developers call this an IF-Statement.

The part marked in red is the CONDITION and the ones in blue are ACTIONS.
The condition is always a question to the system with an unexceptional True or False for the answer. If the condition would sound like ‘IF the car is expensive THEN’ the following action will be up to a subjective assessment of the meaning of ‘expensive’ and no rigorous True or False.

It’s definitely the most used statement in programming and all of us are faced with this procedure over and over. In real life it’s sometimes hard to pursue the right path and we need time to decide and may go another way if our first decision was wrong. The main difference between IFs in software development and in real life is that the CONDITION in real life often cannot be reduced to a Yes or No.

For a better understanding look at this video.
It explains some lines of programming and the result on the iPhone’s screen.

I’m sure this article is boring for developers but can be interesting for normal users as IF-Statements can be effectively used e.g. in Apple’s spreadsheet app Numbers.

So let’s leave the magic activities of app developers behind us and return to daily life.

Consider the following situations …

Mark a line in my spreadsheet to emphasize

  • it’s important
  • it’s greater than 500
  • there are less than 30 days to an event

Unlike in grown up spreadsheet applications installed on big brothers of the iPad conditional formatting is not available in Numbers for iOS. However here is an alternative to feature information.

  • Double tap the cell where a marker should be displayed
  • Select = from the input bar
  • Tap on Functions
  • Select Logical and Information and then If
    Numbers puts a generalized If-Statement into the input bar.
    Your task is now to fill it out with referrals to cells.
  • For defining the If-expression tap on cell C3 and add =High.
  • The action for if-true is to display the marker.
    To do this tap on “abc” on the keyboard. An input bar opens. Enter the marker e.g. from the iOS keyboard Emoji.
  • Repeat the procedure for the if-false part of the expression and in the input bar enter nothing so that nothing is displayed if the priority is not High.

20130120-144509.jpg

Here is the formula for an If-Statement comparing a value with a given value.
The marker is set if the contents of cell C5 is greater than 500.

20130120-145320.jpg

Here is the formula for an If-Statement comparing a given date with the current date using the NOW-Function which provides the current date and time of your devices clock. Additionally the a function called DATEDIF is used which provides the difference between two dates in a selectable unit (day, month, etc.).

20130121-053105.jpg

If you have any questions don’t hesitate to contact me via comment or the contact form on my page ‘About’.

Thanks for visiting http://iNotes4You.com. I hope you come back soon.








Follow

Get every new post delivered to your Inbox.

Join 177 other followers

%d bloggers like this: