Keywords & Methods

Flex Code Documentation

Default Modules

Keywords

Condition Statement Operators

Variable Transform Operators

System Variables

Example Code

//! A simple application that loops through each month since now until the 1st month.
variable day = {$now_day};
variable month = {$now_month};
variable year = {$now_year};
variable looper = 1;
variable endTracking = 1/2023;
variable yearTracking = {$month}/{$year};
variable dateMonths | = January|February|March|April|May|June|July|August|September|October|November|December;

//! Create the loop with $looper as our handle.
loop looper;

//! Decrease by 1 month every loop, start at last month to make sure AI has the data.  
varchange month -= 1;
  variable thisDay = {$day};
  variable lastMonth = {$month};
  varchange yearTracking = {$month}/{$year};
  variable dateMonth = ;
  condition equal_to month 1;
	varchange dateMonth = {$dateMonths[0]};
  end_if;
  condition equal_to month 2;
	varchange dateMonth = {$dateMonths[1]};
  end_if;
  condition equal_to month 3;
	varchange dateMonth = {$dateMonths[2]};
  end_if;
  condition equal_to month 4;
	varchange dateMonth = {$dateMonths[3]};
  end_if;
  condition equal_to month 5;
	varchange dateMonth = {$dateMonths[4]};
  end_if;
  condition equal_to month 6;
	varchange dateMonth = {$dateMonths[5]};
  end_if;
  condition equal_to month 7;
	varchange dateMonth = {$dateMonths[6]};
  end_if;
  condition equal_to month 8;
	varchange dateMonth = {$dateMonths[7]};
  end_if;
  condition equal_to month 9;
	varchange dateMonth = {$dateMonths[8]};
  end_if;
  condition equal_to month 10;
	varchange dateMonth = {$dateMonths[9]};
  end_if;
  condition equal_to month 11;
	varchange dateMonth = {$dateMonths[10]};
  end_if;
  condition equal_to month 12;
	varchange dateMonth = {$dateMonths[11]};
  end_if;

  //! Query the AI.
  ai what was the breaking news on CNN on {$thisDay} of {$dateMonth} {$year};
  
  //! Store the last result to a variable
  variable result = @@;

  //! Log variables and a string
  varlog Example: {$dateMonths} {$dateMonths[1]} {$dateMonth} {$result};

  //! If the 1st month is resolved, end the loop.
  condition equal_to yearTracking {$endTracking};
	varchange looper = 0;
  end_if;  

  //! Let the app wait for 1 second after each loop.
  app_sleep 1000;
end_loop;

//! Generate an image of a cat in a basket.
generate a cat in a basket;

Last updated