- Joined
- Jan 2, 2020
- Messages
- 1,414
I use the terminal a lot when debugging and would like to know if there's a way to skip newlines in the Print statement?
In some old languages you could do Print "not new line just yet";
In some old languages you could do Print "not new line just yet";
Cerberus:
Strict
Import mojo2
Function Main:Int()
New myClass
Return 0
End
Class myClass Extends App
Field canvas:Canvas
Method OnCreate:Int()
SetUpdateRate 0
canvas = New Canvas
' --------------------------------------------
' Input
'
' Ideas for next version :
' variablename.Real = #
' variablename.Imag = #
' Multiplies two complex numbers in the terminal
'
' a + bi * c + di
' e..g (10 + 5i) * (10 + 5i) = =75 + 100i
Local a:Float = 10 ' real
Local b:Float = 5 ' imaginary
'
Local c:Float = 10 ' real
Local d:Float = 5 ' imaginary
Print "The answer is :" ' Avoiding appending strings and put in one Print
Print String((a * c) - (b * d))
Local imaginary:Float = ((a * d) + (b * c))
Local imag:String = String(Abs(imaginary)) + "i"
If imaginary < 0 Then Print "-" + imag
If imaginary > 0 Then Print "+" + imag
' --------------------------------------------
Return 0
End
Method OnRender:Int()
canvas.Clear
canvas.Flush
Return 0
End
End