Forum Discussion

Dicken's avatar
Dicken
Post Prodigy
20 days ago
Solved

Question mark as operator


Hi, can someone explain what ? does  in m code,  I know  ?? can coalesce a  null ot a vlalue  so ; 

= List.Accumulate( {1..10}, {} , (s,c)=> 
  s &  { ( List.Last(s)?? 0 ) + c } )

but i'm not sure what ?  actually does, i been trying to come up with somthing where i use ?  and get 
differenct result from not useing iit, so i presume   null or erorr. 

Richard. 

  • It returns null instead of an error message when referencing a missing record field, list item, or column.

     

    Examine the code below and see how the results change from null to error if you remove the `?` from the relevant records:

    [Source=Table.FromColumns({{1,2,3}},type table[Column1=Int64.Type]),
        x=Source[Column2]?,
        y=Table.Column(Source,"Column1"){3}?]

     

1 Reply

  • It returns null instead of an error message when referencing a missing record field, list item, or column.

     

    Examine the code below and see how the results change from null to error if you remove the `?` from the relevant records:

    [Source=Table.FromColumns({{1,2,3}},type table[Column1=Int64.Type]),
        x=Source[Column2]?,
        y=Table.Column(Source,"Column1"){3}?]