Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
The following examples can be executed directly within RealFlow’s batch script editor. The results will be written to the "Messages" window. To execute a script choose Script > Run from the batch window’s menu.

...

Code Block
themeEclipse
languagepython
linenumberstrue
text = "Hello World"

 

The variable’s name is text” and  and the value is Hello World. The quotation marks indicate that the value is a string – a series of characters. Everything inside the quotation marks is treated as a single value, though it may consist of more than one word. So here, the scalar condition that only one value can be assigned is fulfilled. If you want to assign a number as a value, then no quotation marks are needed, e.g.

...

Naming does not only include double names, it is also about using significant names and descriptions. The first issue is the range of available or allowed characters. You should never use any special characters like %, &, §, ä, Å, É or similar glyphs. These characters are not correctly interpreted and only lead to trouble or errors. The situation gets even worse with conversion between different operating systems. The best method to avoid these problems is to restrict variable names to a limited set of characters:

 

Tip
[ A - Z ], [ a - z ], [ 0 - 9 ], the hyphen [ - ] and the underscore character [ _ ]

 

Another issue is that variables are case sensitive. In Python “friction” is not the same as “Friction”. A variable must keep its name over the entire script and must not be changed. Lastly you have to avoid using full stops (periods) with names under all circumstances. Dots are an element of the Python scripting language, so you cannot use them with variable names. You have already seen the dot with the message statement:

...

Code Block
themeEclipse
languagepython
linenumberstrue
origin      = "Mauritius"
fruit       = "Pineapple"
weight_in_g = 1200
price       = 3.99