Ask your own question, for FREE!
Computer Science 18 Online
OpenStudy (poopsiedoodle):

@opcode

OpenStudy (poopsiedoodle):

OpenStudy (poopsiedoodle):

in vb tho, not sure if there's a c# vers anywhere but idk

OpenStudy (opcode):

It looks like a translating compiler, you define certain functions, and they seem to get converted to a VB.NET or C# equivalent, no? Useful either way. Thank you.

OpenStudy (opcode):

```mnone (main:) function_0: putConsole (1 + 2 / 3) => x x == 0 (function_0) ``` An expression surrounded with round brackets, can be assigned to a variable with =>.

OpenStudy (poopsiedoodle):

so kinda like dim x as bool dim i as integer = rnd * 25 function test() if i > 25 then return true else return false end if end function and then somewhere later x = test()

OpenStudy (opcode):

I do not think that could be made safe, x is a bool, and test() is a function that could return something other than a bool. Unless you define the function to be a bool via a type.

OpenStudy (poopsiedoodle):

ye that's what I was intending forgot to put the return type in there

OpenStudy (poopsiedoodle):

ALSO HOW DID YOU DO THE BIG MULTILINE CODE BOX I MUST KNOW I only know how to do `single line` `boxes` `which looks very` `tacky`

OpenStudy (opcode):

``` //``` // Code here. //``` ``` Remove the //.

OpenStudy (poopsiedoodle):

so ``` poo poooop pooooooooop ```

OpenStudy (poopsiedoodle):

AYEEEEEEEEEEEEEEE

OpenStudy (opcode):

``` (Main:) f_Helloworld: putConsole ("Hello world") => x (x ++ ", the summer breeze brings me to life.") => greeting putConsole greeting ``` On precedence: Main will be executed first. Main contains f_Helloworld, which then prints, "Hello world" to the console, then stories the string literal into the variable x, x is then concatenate with another string literal in the variable greeting, then putConsole at the end prints it to console. In the backend x is evaluated, since putConsole wants to print "Hello world", however greeting is skipped over, however seeing there is a dependency on greeting with the last line, it then evaluates greeting, then prints it to the console.

OpenStudy (opcode):

When determining variables, they are not determined until needed (like with greeting). This reduces the need for mutable variables. So that solves our problem of immutable variables taking too much memory.

OpenStudy (opcode):

For mutable variables, a suggestion from Kai is: "x =' 3 and call it the "equals prime operator" haha"

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!