@bplus
fine the battle dice PC vs PC!...
and I can see that you loves geometry, each face of dice has its geometric formula.
grazie @TempodiBasic per i consigli
cercherò di migliorare dando esempio dal tuo codice
e confrontarlo cosi vedro i miglioramenti del programma
@bplus thanks to you too I see that you enjoy editing programs
and it's nice to see the changes
And the main difference between a SUB and FUNCTION is that you can use a FUNCTION say MyFunction$ that returns a string say "Hello" so
You can PRINT MyFunction$ and get "Hello"
You can use MyFunction$ in an IF MyFunction$ = "Goodbye" THEN END
You can assign a variable: Greeting$ = MyFunction$
So MyFunction$ works just like any other variable.
None of these things can you do with a SUB, you can only call MySub and it will execute a SUB block of code. A SUB does not return a value you can print, or assign to a variable or compare with IF.
Code: QB64: [Select]
There is an excellent dice rolling routine in 'mboard.bas' in the samples directory in your qb64 directory. It even simulates rolling dice.
There is an excellent dice rolling routine in 'mboard.bas' in the samples directory in your qb64 directory. It even simulates rolling dice.
The ideal in programming is to avoid reinventing the wheel ie. reusable code. The function returns dice total and shows just how complicated a function can be. It can also be adapted to many uses with little alteration (reused) . Which was why I brought it up in the first place. Isn't that why there are code libraries?