• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Can you guess the output of this code?

Holzchopf

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jul 31, 2017
Messages
500
Today I'm challenging you a bit =) Have a look at this code and try to figure out, what it will produce. Then run it. Don't worry, it won't destroy anything.

Strict

Function Main:Int()
Quirky.Run()
Return 0
End

Class Quirky
Function Run:Void()
Local i:Int, o:Int, O:Int, I:Int
Local txt:String
Local name1:String = "Alice"
Local name2:String = "Bob"

' try to guess the output
Print("I'm up!")
#rem
Well actually that one was easy, wasn't it?

But behold! It's getting worse >:)
#end


' let's see if we can break it
For i = 5 To 1 Step -1
Print(i)
Next
Print("I'm still up!")
' that was too easy, try some maths
For i = 5 To 1 Step -1
o = i * 4 - 6
O = -o * 5 - 11
I = (O - 19) / -20
Print(I)
Next

Print("I'm still up!")

'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
' JUST SOME COMMENTS - DO YOU THINK THEY INFLUENCE THE CODE IN ANY WAY?
#rem

Or, maybe, I'm a magician and all this is just to distract you from the real
thing that's going on

#end
.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'

' guess again
Print("I'm still up!")
' WAIT WHAT?
Print "Who said that? (Looking at "+name1+" who's standing next to Bob)
' It's always important to have director instructions in scripts like
' these, isn't it?
' Now let's find Bob.
Print( name2 ) ' <- here he is
' (Yes he is. Now find him in the output window)
' Somehow we're still looking for bob..?
' Anyways... Do you know the meaning of these emojis?
' ( ͡° ͜ʖ ͡°)
' ¯\_(ツ)_/¯
' ʕ•ᴥ•ʔ
' (⊙_☉)
' .·´¯`(>▂<)´¯`·.
' )))'"[o..O]'"(((
' (o・_・)ノ”(ᴗ_ ᴗ。)
' ლ(ಠ_ಠლ)
Print("Done finding Bob yet?")
End

' this overloads Print so it always appends "Simon says:"
Function Print:Void(pString:String)
.Print "Simon says: ~q" + pString + "~q"
End
End


HA HA I like how the syntax highlighter of the forum breaks some lines before the code does :D

Now be honest - did you guess everything correct?

Edit damn the syntaxhighlighting of the forum software is better than that one of TED/Mollusk and already gives away some things
 
Last edited:
Psst! :D

(but honestly: don't worry, not a single comment influences the code)
 
Btw. I fixed your #rem #end issue. #end has to be always written small.
 
Nooooo this gives away the quirks in the code :-O

Edit
Had to remove the code tags. Seeing things through the forum-syntax-highlighting is cheating :p

Edit II
But thanks for the corrections anyways. I'll try to remember that ;-)
 
Back
Top Bottom