Skip to main content

Posts

Post 5: Repeated Action Syntax

Recent posts

Post 4: Conditional Statements

Conditionals Conditionals in Fantom are comprised of if-statements, if-else statements, and switch statements. If-statements If-statements in Fantom remain virtually the same to if-statements in it's parent languages, Java and C#. The if-statement takes some form of conditional and will only perform the block of code inside of it IF the condition stated is true. Every if-statement will be checked if performed in a sequence, however if-else statements will stop once the first true condition is met and perform the nested code. Else will only be performed if none of the previous conditionals have been satisfied. Switch Statements Switch statements remain very similar to Java and C# as well, however with some syntax differences. A switch condition is declared at the start and is compared to the list of case labels below it, executing code when a condition is met. If none of the conditionals are met, there is a default condition that works like the else of and if-statement....

Post 3: Constants, Variables, and Arithmetic Operations

Constants, Variables, and Arithmetic Operations Variables Types Variables that would be considered primitives in Java (int, bool, float, etc.) are sub-classes of the Object class in Fantom. This allows them to contain various useful methods and allows for Fantom to remain fully object-oriented without sacrificing any performance gains from primitives. This follows the .NET standard of handling primitives. The Following are all of the Variable Types I will cover in this blog post: Bool Int Float Decimal Str Duration Uri Range List When declaring variables in Fantom, ':=' is used instead of '='. However, when updating a variables value, '=' should be used instead of ':='. Variables in Fantom don't need to be assigned a variable type during declaration. Both of these will compile fine: Integers The Integer variable type can hold any positive or negative whole number ranging from 9,223,372,036,854,775,807 to -9,223,3...

Post 2: Hello World! Program

Hello World! F4 IDE The official F4 IDE is no longer maintained by the original creators but can be attained from the Xored website, or an updated open source copy is available on Github .  The Windows version of the F4 IDE works fine for me, however I was unable to get the MacOS version to launch so working with this IDE on a Mac may prove to be a challenge. If you are familiar with the Eclipse platform then F4 will look rather familiar. F4 is based on the Eclipse platform and functions relatively similar, just without a useful dark theme. The default window configuration for F4 is almost identical to that of Eclipse and is fully customizable. The 'Fantom Explorer' on the left contains the file tree for all of your projects in your workspace. On the right, there is an 'Outline' view which shows the outline for the current Fantom Class file that you are working on including methods and functions. The 'Console' window and 'Error Log' window a...

Post 1: Background Information and Resources

Language Background Fantom is an object-oriented programming language designed to work in both the Java Runtime Environment and in the .NET Common Language Runtime while providing a more refined API that maintains much of the same functionality.  Fantom's syntax is relatively similar to that of Java and C# while refining certain aspects of the syntax for functionality and simplicity.  System.out.println("Hello world!"); becomes  echo("Hello world!") Fantom is designed to be portable between the Java and .NET VMs while also holding support for being compiled to JavaScript for browser use, making Fantom versatile.  Creators Fantom was created in 2005 by Brian Frank and Andy Frank and was originally named Fan. When the language began to gain some popularity, the name was changed to Fantom in order to address concerns about the ability to search for resources on a language named "Fan". The creators say that Fantom was created in orde...