• Hi Guest!

    We have posted a new VaM2 dev log on Patreon, starting a monthly cadence of written progress updates between Beta releases. Highlights include the new Gizmos System, Selection Carousel, and Modes System with Context-Specific Editing. Beta1.2 is 15 of 21 items complete.

    Read the full post on Patreon, or follow progress on the public Trello roadmap.

? operator in float? -- what does it do?

AWWalker

Another White Walker (AWWalker)
Featured Contributor
Joined
Jun 1, 2020
Messages
435
Reactions
2,915
@MacGruber and @lfe

Searching for something with a ? in it on the google, well, it doesn't really respond correctly. In @lfe 's extra auto gen 3.0, the following line of code:

C#:
public float? NextMorphValue(float? velocityRaw, float friction)

What does the ? do? Is that for dynamic variables or something? Trying to do the same sort of thing so I can make a plugin that stores all my favorite morphs in one session, instead of hunting down the additional morphs in the morphs GUI, or manually creating entries for each in a plugin. Then find how to store them in a reusable way.

Self taught coder, so what i don't know yet, i don't know :)
 
The irony of questions about question marks. The struggle is real.

C# has a numer of places that you can use question marks.

This one is to allow the return value to be a float that could be null, and the parameter can take a float that may be null as well. I probably did this so that I could distinguish between 'null' (could not calculate one) and '0' (next value should be 0).

More on the nullable type here:
 
ok, that makes sense now. And the IDE is hinting that when i remove the ? and telling me it could return null, it can't be null etc... cool.
 
Back
Top Bottom