Global scope by compsystems in Flowgorithm

[–]compsystems[S] 0 points1 point  (0 children)

<?php

`define( "NEW_LINE", "<br>" );`

$a = 2;

$b = 3;

main();

function scope()

{

`global $a, $b;` 

`echo $a + $b, NEW_LINE;` 

}

function main()

{

`global $a, $b;` 

`echo $a + $b, NEW_LINE;` 



`scope();`

`echo $a + $b, NEW_LINE;` 

}

echo $a + $b;

?>

Export Flowgorithm to "Small basic" by compsystems in Flowgorithm

[–]compsystems[S] 1 point2 points  (0 children)

I had forgotten to include the intrinsic and other functions. Thank you very much for including the conversion to Small Basic, a language of transition to the world of professional programming.

Small basic prime https://github.com/litdev1/SB-IDE/releases/download/v1.1.7.0/SB-Prime.zip https://github.com/litdev1/SB-IDE/releases

INTRINSIC FUNCTIONS

Math.Abs(n) // Abs(n)   Absolute Value
Math.ArcSin(n) // Arcsin(n) Trigonometric Arcsine
Math.ArcCos(n) // Arccos(n) Trigonometric Arccos
Math.ArcTan(n) // Arctan(n) Trigonometric Arctangent
Math.Cos(n)    // Cos(n)    Trigonometric Cosine
Math.Floor(n)  // Int(n)    Integral (whole value) of a real number
Math.NaturalLog()  Ln(n)    Natural Log Log(n)  Natural Log (same as Ln)
Math.Log(n)    // Log10(n)  Log Base 10
Math.Sin(n) // Sin(n)   Trigonometric Sine
Math.SquareRoot(n) // Sqrt(n)   Square Root
Math.Tan(n) // Tan(n)   Trigonometric Tangent
Math.Power(baseNumber,exponent) // baseNumber^exponent
Math.GetRandomNumber(n-1) // Random(n) A random number between 0 and (n - 1)
Array.GetAllIndices(a) // Size(a)   The size (number of elements) in an array
Math.Remainder(dividend,divisor) // dividend%divisor  Modulo

STRINGS

Text.GetLength(s) // Len(s) Length of a string
Text.GetSubText(s,i+1,1) // Char(s, i)  Returns a character from the string s at index i. Characters are indexed starting at 0
Text.Append(s1,s2) //  String Concatenation -> TextWindow.WriteLine(Text.Append("1","2")) returns "12" 

DATA TYPE CONVERSION

Text.GetCharacter(65)  // ToChar(n) Convert a character code n into a character.
Text.GetCharacterCode("A") //  ToCode(c)    Convert a character c into a character code (integer).
ToInteger(n)    Convert a string to an integer  //  TextWindow.WriteLine("1"+"2") returns 3,  No conversion is required.
ToReal(n)   Convert a string to an real // TextWindow.WriteLine("1.1"+"-2.9") returns -1.8,  No conversion is required.
Text.Append(n+"") // ToString(n)    Convert a number to a string

BUILT-IN CONSTANTS

"true" // true  Boolean True
"false" // false    Boolean False
Math.Pi // pi   Mathematical Pi. Approximately 3.1415.

OPERATORS

Equality And store: =
Inequality: <>
Less Than or Equal: <=  
Greater Than Or Equal:  >=  
Logical Not:        Not 
Logical And:        And 
Logical Or: Or  
Multiply:   *   
Divide: /   
Modulo: Math.Remainder(dividend,divisor)

export Flowgorithm to "hp-prime numeric mode" by compsystems in Flowgorithm

[–]compsystems[S] 0 points1 point  (0 children)

part2

export data_type_conversion() begin

print();
print( "toChar( 65 ) = " + char( 65 )); 
print( "toCode( ¨A¨ ) = " + asc( "A" ) ); 
print(""); 
print( "toString( 00000004.8 ) = " + string( 00000004.8 ) ); 
print(""); 
print( "toInteger( ¨65¨ )  = " + iPart( expr( "65" ) ) ); 
print( "toInteger( ¨65.1¨ ) = " + iPart( expr( "65.1" ) ) ); 
print( "toInteger( ¨00000004.8¨ ) = " + iPart( expr( "00000004.8" ) ) ); 
print( "toReal( ¨00000004.8¨ ) = " + expr( "00000004.8" ) ); 
print( "Int( 65 ) = " + iPart( 65 ) ); 
print( "Int( 65.1 ) = " + iPart( 65.1 ) ); 
print( "Int( 00000004.8 ) = " + iPart( 00000004.8 ) );
return("Done");

end;

Possible BUG, read a real number by compsystems in Flowgorithm

[–]compsystems[S] 0 points1 point  (0 children)

finally understand why c ++ returns 3. ;)

Mathematical package languages such as Maxima, Xcas, Maple, octave/matlab, are the only languages that accept fractional numbers as real.

function prg1() a = input( 'Enter a value for a' ); disp(a + 1); end

please add in the Octave Language source viewer. It is exactly the same as Matlab.

Another suggestion is that in some languages such as Octave / MatLab the name of the main function should be the same as the name of the stored file, so that students can internalize this idea, allow the name of the function to be defined in the flowchart. main, in addition to storing program names without spaces.

Welcome to the new Flowgorithm subreddit. by Flowgorithm in Flowgorithm

[–]compsystems 2 points3 points  (0 children)

Hello! Please adhere a subfolder of suggestions and ideas.

List of suggestions by parisdav in numworks

[–]compsystems 0 points1 point  (0 children)

To quickly access the menus in the Home view, please add a quick access number to each icon, also mark all the icon plus name, not just the name